android - 依赖项 'android.arch.core:runtime' 具有不同版本的编译和运行时类路径

标签 android android-studio compiler-errors android-gradle-plugin dependencies

我将一个项目转换为一个库,然后在另一个项目中使用它,但问题是当我尝试在 gradle 中调用它时: 实现项目(':library'),我得到了这个错误:

Android 依赖项 'android.arch.core:runtime' 对于编译 (1.1.0) 和运行时 (1.1.1) 类路径有不同的版本。
您应该通过 DependencyResolution 手动设置相同的版本

我在这两个方面都有很多依赖关系。

我的应用程式:

android {
   compileSdkVersion 28
   buildToolsVersion '28.0.2'
     defaultConfig {
    applicationId "com.free.caller"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation 'com.android.support:cardview-v7:27.1.1'

implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-ads:16.0.0'


implementation 'com.github.satyan:sugar:1.5'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.wang.avi:library:2.1.3'


implementation('com.github.alex31n:andutils:1.0.4') {
    transitive = false
}
implementation('com.ornach.bitpermission:bit-permission:1.1') {
    transitive = false
}
implementation('com.ornach.nobobutton:nobobutton:1.6') {
    transitive = false
}
implementation('com.ornach.magicicon:magic-icon:1.6') {
    transitive = false
}
implementation('com.ornach.richtext:richtext:1.0') {
    transitive = false
}
implementation 'com.github.GrenderG:Toasty:1.3.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'com.github.florent37:expansionpanel:1.1.1'

implementation 'com.github.bumptech.glide:glide:3.7.0'

  //// ----  when i call it, the error showed up
implementation project(':library')

}

我的库 gradle:

android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
defaultConfig {

    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true

}
buildTypes {
    release {
        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }


}

lintOptions {
    checkReleaseBuilds false
    abortOnError false
}
  compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2') {
    exclude module: 'support-annotations'
}

implementation 'com.github.TeamNewPipe:NewPipeExtractor:217d13b1028'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.8.9'

implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:preference-v14:27.1.1"
implementation 'com.android.support:cardview-v7:27.1.1'


implementation 'ch.acra:acra:4.9.2'

implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.nirhart:ParallaxScroll:dd53d1f9d1'
implementation 'com.nononsenseapps:filepicker:4.2.1'

implementation "com.google.android.exoplayer:exoplayer:2.8.2"
implementation "com.google.android.exoplayer:extension-mediasession:2.8.2"

debugImplementation "com.facebook.stetho:stetho:1.5.0"
debugImplementation "com.facebook.stetho:stetho-urlconnection:1.5.0"
debugImplementation 'com.android.support:multidex:1.0.3'

implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'

implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"

implementation "frankiesardo:icepick:3.2.0"
annotationProcessor "frankiesardo:icepick-processor:3.2.0"

debugImplementation "com.squareup.leakcanary:leakcanary-android:1.5.4"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:1.5.4"

implementation "com.squareup.okhttp3:okhttp:3.10.0"
debugImplementation "com.facebook.stetho:stetho-okhttp3:1.5.0"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
}

我认为导致这个问题的所有原因是这些行:

implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"

最佳答案

我遇到了同样的问题,所以我解决了更新谷歌服务

类路径'com.android.tools.build:gradle:3.2.1' 类路径 'com.google.gms:google-services:4.2.0'

Ps,如果将 gradle 更新到 3.3.0 或更高版本,显示错误,这是我的情况,所以我决定像这样设置 gradle 然后它完美工作!

关于android - 依赖项 'android.arch.core:runtime' 具有不同版本的编译和运行时类路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51295295/

相关文章:

java - 奇怪的 "cannot find symbol"错误(从终端编译包)

java - Android 上使用 java 的异步音频播放器

android - onRestart() 在按下后退按钮时被调用,有什么办法可以防止这种情况发生?

android - 如何使用 Kotlin 同时定位 JVM/Native 和 Android

java - Android Studio 创建操作栏

emacs - Emacs : wrong-type-argument error in Emacs23 but not in Emacs24

android - Youtube API 视频在非全屏时停止

java - 无法重定向到 Android 中的另一个 Intent

android - Lint 在组装发布目标时发现 fatal error

java - 用于安装 R 包的备用编译器 : clang: error: unsupported option '-fopenmp'