Gradle Duplicate Entry

一笑奈何 提交于 2019-12-18 08:49:20

问题


I integrated the Digits mobile sdk into my project and it wouldn't build anymore. It has some kind of a clash with gson library that i am using. I get this error during the build:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/gson/Gson$5.class

this is my build.gradle

buildscript {
    repositories {maven { url 'https://maven.fabric.io/public' }}
    dependencies {classpath 'io.fabric.tools:gradle:1.+'}}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.0"
    defaultConfig {...}
    buildTypes {release {...}}
    dexOptions {preDexLibraries = false
    incremental true
    javaMaxHeapSize "4g"}
    packagingOptions {...}}
repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }}
dependencies {
    ...
    compile('com.crashlytics.sdk.android:crashlytics:2.2.4@aar') {
        transitive = true;}
    compile 'io.branch.sdk.android:library:1.5.5'
    compile('com.digits.sdk.android:digits:1.5.0@aar') {
        transitive = true;}}

回答1:


this is the solution

compile('com.digits.sdk.android:digits:1.5.0@aar') {
    transitive = true;
    exclude module: 'gson';
}

you need to add exclude module: 'gson'



来源:https://stackoverflow.com/questions/30727582/gradle-duplicate-entry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!