Moe Moe - 4 months ago 27
Android Question

Transforming Classes With Jar, Merging For Debug duplicate entry

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;
}


}


`

Answer

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;
}