priya.vr
priya.vr

Reputation: 239

com.android.build.api.transform.TransformException:

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;
}

}

Upvotes: 1

Views: 549

Answers (1)

Yev Kanivets
Yev Kanivets

Reputation: 1800

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.

Upvotes: 1

Related Questions