2

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


}

`

Mo Hajr
  • 1,253
  • 1
  • 15
  • 31
  • are there any libs of yours using support v4 or support v7? it causes this error – Nisarg Jul 12 '16 at 10:02
  • Am sorry but am a kind of a beginner so how could I Know that one of them using support v4 or v7 ! ^^ – Mo Hajr Jul 12 '16 at 13:13
  • its fine dude and check [this](http://stackoverflow.com/a/30806952/3117966) – Nisarg Jul 12 '16 at 13:17
  • I excluded the supp-v4 module and still nothing same error – Mo Hajr Jul 12 '16 at 13:42
  • Just to chime in here from the Branch.io perspective: this isn't an error we've seen before, so it's likely not related to the Branch SDK – Alex Bauer Jul 13 '16 at 03:20
  • But the class that has duplicated entry is only exits in crashlytics and branch answers-shim jar – Mo Hajr Jul 13 '16 at 06:46
  • Even if I removed crashlytics from dependencies still got the error ... – Mo Hajr Jul 13 '16 at 06:47
  • @Moe now which errors you are getting? – Nisarg Jul 13 '16 at 07:15
  • The same errors nothing never changed. even after removing crashlytics dependency so confusing.. the sdk keep installing itself even after removing the dependency – Mo Hajr Jul 13 '16 at 07:33
  • @Moe this required trial and error i had same error solved by excluding v4 and try searching solution for same error, try every solution – Nisarg Jul 13 '16 at 08:35
  • Is there is a way to exclude the com/crashlytics/android/answers/shim/AnswersKitEventLogger.class or its folder answers-shim-0.0.3 – Mo Hajr Jul 13 '16 at 08:57
  • Guys, this is related to branch.io, I got the same error now when building off proguard:Warning: Exception while processing task java.io.IOException: Can't write [Documents/Material/material/app/build/intermediates/transforms/proguard/release/jars/3/1f/main.jar] (Can't read [Documents/Material/material/app/build/intermediates/exploded-aar/io.branch.external.answersshim/answers-shim/0.0.4/jars/classes.jar(;;;;;;**/*.class)] (Duplicate zip entry [classes.jar:com/crashlytics/android/answers/shim/AnswersKitEventLogger.class])) :app:transformClassesAndResourcesWithProguardForRelease FAILED – Simon Aug 02 '16 at 18:39

3 Answers3

3

This issue is fixed in Branch SDK v2.1.0

Sojan P R
  • 536
  • 6
  • 9
  • Or you can add this `compile ('io.branch.sdk.android:library:2.+') { exclude module: 'answers-shim' }` – lxknvlk Mar 27 '17 at 15:02
1

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'
}
Sojan P R
  • 536
  • 6
  • 9
  • this should be the accepted answer, it also follow Branch documentation where they suggest exclude the answers module https://dev.branch.io/getting-started/sdk-integration-guide/guide/android/#get-the-sdk-files – lxknvlk Mar 27 '17 at 15:03
0

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