1

Why am I getting this error it will not occurred when I sync the gradle but when I am running the project I am getting this error .

Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzf.class

I don't know which dependency cause this error, My dependencies are .

dependencies {
compile project(':RNAdMob')
compile project(':react-native-maps')
compile project(':react-native-fcm')
compile project(':react-native-device-info')
compile project(':react-native-splash-screen')
compile project(':react-native-calendar-events')
compile project(':react-native-device-token')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"  // From node_modules

compile (project(':react-native-fcm')){
    exclude group: "com.google.firebase"
}
compile(project(':react-native-maps')){
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile ("com.google.android.gms:play-services-base:10.0.1")
        {
            force = true;
        }
compile ("com.google.android.gms:play-services-maps:10.0.1")
        {
            force = true;
        }
compile ('com.google.firebase:firebase-core:10.0.1') {
    force = true;
}
compile ('com.google.firebase:firebase-messaging:10.0.1') {
    force = true;
}
compile (project(':react-native-device-info')){
    exclude group: "com.google.android.gms"
}
compile ('com.google.android.gms:play-services-gcm:10.0.1'){
    force = true;
}

}

7
  • Try to exclude group: "com.google.android.gms" from ':react-native-fcm' also. Commented Sep 26, 2017 at 11:04
  • not work for me @EvgeniiKanivets Commented Sep 26, 2017 at 11:10
  • Try to exclude it from everywhere one by one) Commented Sep 26, 2017 at 11:15
  • I had similar issues some time ago. Please look at my comment here: github.com/invertase/react-native-firebase/issues/… Perhaps that can be helpful. Commented Sep 26, 2017 at 11:44
  • Thanks @EvgeniiKanivets issue is solved Commented Sep 26, 2017 at 12:57

1 Answer 1

1

Such an issue usually caused by internal dependency of some of your dependency. So you need to exclude conflicted dependency from your dependency. But in most cases you as developer don't know which library you need to exclude from.

So just try adding exclude group: "com.google.android.gms" to all the libraries one by one and try compile. When project is compiled, you have found the needed library to exclude from.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.