1

I get the following error:Error:Execution failed for task':app:transformClassesWithJarMergingForDebug'.> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/actions/ReserveIntents.class

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
    applicationId "com.XXXXXXXXXXX.XXXXX"
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 2
    versionName "1.1"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.github.nisrulz:qreader:1.0.6'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
debugCompile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile project(':barcode-android')
compile project(':barcode-core')
compile 'com.google.firebase:firebase-messaging:9.2.1'
compile project(':imagepicker')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.afollestad.material-dialogs:commons:0.9.0.1'
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
compile 'de.hdodenhof:circleimageview:2.1.0'
 }

Update: Two Jar Files are org.apache.commons.collections and com.google.common I checked both are not have ReserveIntent class.But when I removed firebase from gradle everything is working.

Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64

2 Answers2

5

After lot of try I found the approach to fix it .

Step 1: switch to project mode

Step 2: Explore the library which you feel is the reason for duplicate.

In my case I was looking for com.google.android.gms with Class ReserveIntents

Step 3: Once you find it check the library which can be removed because its feature might be used in other lib.

write below code in app.gradle under android root to remove library

configurations {
    all*.exclude  module: 'library name'
}

In my case duplicate entry was in play-service-base and play-service-basement.

configurations {
    all*.exclude  module: 'play-services-base'
}

enter image description here

Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64
0

I'm using Cordova for Android development. remove cordova.system.library.1=com.google.android.gms:play-services-ads:+ from platforms/android/project.properties