android - 由于其他模块中的 Relinker 库类重复,构建失败

标签 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 是最新的。我搜索了解决方案,但找不到。错误消息中的那些库甚至不在我的依赖项列表中。我该如何解决这些问题?

最佳答案

使用

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

而不是最新版本或

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

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

关于android - 由于其他模块中的 Relinker 库类重复,构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56565961/

相关文章:

java - 有没有更系统的方法来填充我的布局?

java - 调用 .text() 方法时 Jsoup 元素不显示

java - 使用 SAX 进行解析时如何保留未绑定(bind)到对象的 XML 节点

java - 无法使用提供的 Gradle 包装器或系统 Gradle 构建新创建的 Grails 6.0.0 应用程序

java - 如何检查,某个类的源库是什么? java

Gradle 包含由 war 中的另一个项目生成的 jar

java - 一种禁用动态加载的 JAR 之间共享 Gradle 依赖关系的方法

android - 为什么我不在我的应用程序的目标群体中?

Javascript代码依赖分析工具

java - 使用 gradle 的多项目测试依赖项