1

Hi i am trying to build APK but i Fetching this problem in Android Studio.

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

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/gcm/INetworkTaskCallback$Stub.class

Gradle file :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
     defaultConfig {
      applicationId "com.example.mouad.fixmyphone"
      minSdkVersion 15
      targetSdkVersion 25
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner    "android.support.test.runner.AndroidJUnitRunner"
      // Enabling multidex support.
      multiDexEnabled true
   }
   dexOptions {
        javaMaxHeapSize "4g"
  }
   buildTypes {
      release {
           minifyEnabled false
               proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
        }
    }
   useLibrary 'org.apache.http.legacy'

 }
 android {
     packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
      }
 }

 dependencies {
 compile fileTree(include: ['*.jar'], dir: 'libs')
 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',          {
    exclude group: 'com.android.support', module: 'support-annotations'
   })
   compile 'com.android.support:appcompat-v7:25.1.1'
   compile 'com.android.support:design:25.1.1'
   compile 'com.android.support:support-v4:25.1.1'
   compile 'com.android.support:multidex:1.0.1'
   compile 'com.miguelcatalan:materialsearchview:1.4.0'
   compile 'com.google.firebase:firebase-core:10.2.1'
   compile 'com.google.firebase:firebase-messaging:10.2.1'
   compile 'com.firebase:firebase-client-android:2.5.2'
   compile 'com.firebase:firebase-jobdispatcher:0.5.2'
   compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
   testCompile 'junit:junit:4.12'
   }
    apply plugin: 'com.google.gms.google-services'
ALiiLA
  • 55
  • 1
  • 11

1 Answers1

0

The documentation for Firebase JobDispatcher says to include only one of these:

compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'

You are including both. Because your app does not have a dependency on com.google.android.gms:play-services-gcm, you should only include this library:

compile 'com.firebase:firebase-jobdispatcher:0.5.2'

Remove this line from your dependencies:

compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
  • Man,you save my day i spent all day for resolve this problem thanks so much – ALiiLA Mar 25 '17 at 14:51
  • Another thing to consider: You are using both the legacy Firebase SDK, `firebase-client-android:2.5.2` and the new SDK, `com.google.firebase:firebase-messaging:10.2.1`. This may work now, but if you continue to add libs from the new SDK, you may run into conflicts. The [Upgrade Guide](https://firebase.google.com/support/guides/firebase-android) is a good resource. – Bob Snyder Mar 25 '17 at 14:58
  • Thanks for your observation , Wich one should I remove : firebase-client-android:2.5.2 Or com.google.firebase:firebase-messaging:10.2.1 – ALiiLA Mar 25 '17 at 15:12
  • Remove `firebase-client-android:2.5.2`. If that creates errors, follow the instructions in the Upgrade Guide. – Bob Snyder Mar 25 '17 at 15:15
  • i removed firebase-client-android:2.5.2 and everything works fine, Thank you for help me – ALiiLA Mar 25 '17 at 15:25