Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Duplicate Entry

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;}}
like image 971
Osama Raddad Avatar asked Jun 09 '15 09:06

Osama Raddad


1 Answers

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'

like image 138
Osama Raddad Avatar answered Sep 19 '22 06:09

Osama Raddad