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

问题描述 投票:2回答:1

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

Android依赖项'android.arch.core:runtime'具有不同版本的编译(1.1.0)和运行时(1.1.1)类路径。 您应该通过DependencyResolution手动设置相同的版本。 而且我在两者中都有很多依赖。

我的应用程序gradle:

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"
android android-studio compiler-errors android-gradle dependencies
1个回答
0
投票

我遇到了同样的问题,所以我解决了google-services的更新问题

classpath'com.android.tools.build:grad:3.2.1'classpath'com.google.gms:google-services:4.2.0'

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

© www.soinside.com 2019 - 2024. All rights reserved.