由于Relinker库类在其他模块中重复,因此构建失败

时间:2019-06-12 15:42:55

标签: android gradle dependencies

我已启动并运行此应用程序,直到在更新一些代码并重建时突然出现这些错误:

Duplicate class com.getkeepsafe.relinker.ApkLibraryInstaller found in modules classes.jar (com.getkeepsafe.relinker:relinker:1.2.2) and classes.jar (pl.droidsonroids.relinker:relinker:1.3.1)
Duplicate class com.getkeepsafe.relinker.BuildConfig found in modules classes.jar (com.getkeepsafe.relinker:relinker:1.2.2) and classes.jar (pl.droidsonroids.relinker:relinker:1.3.1)
...

Go to the documentation to learn how to Fix dependency resolution errors.

这是我的build.gradle(应用模块)文件,看起来像:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'

android {
    ...
    compileSdkVersion 28
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.mrrideconfig
        }
    }
    productFlavors {
    }

    repositories {
        flatDir {
            dirs 'libs'
        }
    }
}

...

dependencies {
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
    implementation(name: 'walletmixopglibrary', ext: 'aar')
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.google.code.findbugs'
    })
    implementation('com.mikepenz:fastadapter:2.0.0@aar') {
        transitive = true
    }
    implementation 'com.afollestad.material-dialogs:core:0.9.0.0'
    implementation 'com.mikepenz:iconics-core:2.8.1@aar'
    implementation 'com.mikepenz:fontawesome-typeface:4.6.0.2@aar'

    implementation('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
        exclude module: 'support-v4'
    }
    androidTestImplementation 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.guava:guava:24.1-jre'
    implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4'
    implementation 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
    implementation 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'me.relex:circleindicator:1.2.2@aar'
    implementation 'com.squareup.okhttp3:okhttp:3.14.1'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.14.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-messaging:17.6.0'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'com.mobsandgeeks:android-saripaar:2.0.3'
    //implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-places:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-nearby:16.0.0'

    implementation 'org.greenrobot:eventbus:3.1.0'
    implementation 'com.makeramen:roundedimageview:2.2.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.3'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

}


apply plugin: 'com.google.gms.google-services'

和build.gradle(项目模块)文件:

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.realm:realm-gradle-plugin:4.2.0'
        classpath 'io.fabric.tools:gradle:1.28.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
       // maven {
       //     url 'https://maven.google.com/'
      //      name 'Google'
      //  }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我的Android Studio版本是3.4.1,SDK是最新的。我搜索了一种解决方案,但找不到。错误消息中的那些库甚至不在我的依赖列表中。我该如何解决这些问题?

3 个答案:

答案 0 :(得分:1)

由于pl.droidsonroids.gif与COM getkeepsafe.relinker更新到1.2.17重新链接器冲突...

答案 1 :(得分:0)

使用

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'

代替最新版本或

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'

其重新链接器类与领域库冲突。这是我目前唯一知道的方法。

答案 2 :(得分:0)

我有一个类似的问题,我通过更改来解决了

api 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'

api 'pl.droidsonroids.gif:android-gif-drawable:1.2.1'
相关问题