Transforming Classes With Jar, Merging For Debug duplicate entry

对着背影说爱祢 提交于 2020-01-04 02:43:09

问题


This is a screenshot from the duplicated classesWhen I started integrating Digits I had to upgrade Crashlytics after upgrading every time I build the app on pre-Marshmallow Devices I got build Error This one

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/crashlytics/android/answers/shim/AnswersKitEventLogger.class

After searching for a while I already tried to ./gradlew clean command and I figured that there is two classes with that same Name ANswersKitEventLooger.class One of them under answers-shim-0.0.3 Library in Crashlytics and the other one under answers-shim-0.0.4 in Branch Library

I also try to exculde then in the build.gradel but nothing seems to work so far `

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'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {

        minSdkVersion 15
        targetSdkVersion 22

        // Enabling multidex support.
        multiDexEnabled true
    }

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

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')

    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.facebook.android:facebook-android-sdk:4.8.0+'
    compile 'com.xgc1986.android:parallaxpagertransformer:1.0.3'
    compile 'com.facebook.rebound:rebound:0.3.7'
    compile 'com.ogaclejapan.smarttablayout:library:1.1.3@aar'
    compile files('libs/AudienceNetwork.jar')
    compile files('libs/android-async-http-1.4.4.jar')
    compile files('libs/ebizu-redemption.jar')
    compile files('libs/universal-image-loader-1.9.1.jar')
    compile files('libs/zxing-core.jar')
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
    compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
    compile 'io.branch.sdk.android:library:1.+'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.daimajia.easing:library:1.0.1@aar'
    compile 'com.daimajia.androidanimations:library:1.1.3@aar'
    compile 'com.android.support:multidex:1.0.1'

    compile('com.crashlytics.sdk.android:crashlytics:2.6.0@aar') {
        transitive = true;
    }
    compile('com.digits.sdk.android:digits:1.11.1@aar') {
        transitive = true;
    }


}

`


回答1:


This issue is fixed in Branch SDK v2.1.0




回答2:


This look like an issue caused by using Branch and Digits together. Both uses answers-shim module. The easy fix is to exclude answers-shim either from Branch or from Digits. The following in build.gradle works fine

compile 'io.branch.sdk.android:library:1.+'
compile('com.crashlytics.sdk.android:crashlytics:2.6.1@aar') {
    transitive = true;
}
compile('com.digits.sdk.android:digits:1.11.1@aar') {
    transitive = true;
    exclude module: 'answers-shim'
}



回答3:


Following gradle config works for me.

compile('com.twitter.sdk.android:twitter:1.14.1@aar') {
    transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.0@aar') {
    transitive = true;
}
compile('io.fabric.sdk.android:fabric:1.3.12@aar') {
    transitive = true;
}
compile('io.branch.sdk.android:library:1.14.0@aar') {
    transitive = true;
}


来源:https://stackoverflow.com/questions/38325388/transforming-classes-with-jar-merging-for-debug-duplicate-entry

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