0

I have implemented Firebase cloud messaging into my application and i am getting 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/internal/zzqd.class

My dependencies

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile project(':module2')
}
apply plugin: 'com.google.gms.google-services'

If you do need Any thing else tell me i will provide that to.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Kanwar preet
  • 9
  • 1
  • 7

3 Answers3

1

Firebase can generate DuplicateFileException so you have to add the following inside your app level build.gradle as well. The following block would be added inside the android block just below the buildTypes block.

//Add the following block
packagingOptions{
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'

}

P.S. This and Michele's answer combined worked for me.

Aman Grover
  • 1,621
  • 1
  • 21
  • 41
0

Try this

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile project(':module2')
}
apply plugin: 'com.google.gms.google-services'
Michele Lacorte
  • 5,323
  • 7
  • 32
  • 54
0

@Kanver Preet Checkout this link it was already answered here

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

Community
  • 1
  • 1
Piyush Patel
  • 371
  • 1
  • 5
  • 13