2017-09-26 25 views
1

爲什麼我得到這個錯誤,當我同步gradle時不會發生這種錯誤,但是當我運行該項目時,出現此錯誤。com.android.build.api.transform.TransformException:

任務':app:transformClassesWithJarMergingForDebug'的執行失敗。

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重複的條目:COM /谷歌/安卓/ GMS /普通/ API/zzf.class

我不知道哪個依賴會導致這個錯誤,我的依賴是。

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

}

+0

嘗試從':react-native-fcm'排除組:「com.google.android.gms」。 –

+0

對我來說不起作用@EvgeniiKanivets –

+0

儘量將它從一個一個的地方排除) –

回答

1

這種通常由一些你所依賴的內部依賴性造成的問題。所以你需要從你的依賴中排除衝突的依賴。但在大多數情況下,你作爲開發人員不知道你需要從哪個庫中排除。

因此,只要嘗試將exclude group: "com.google.android.gms"逐個添加到所有庫中,然後嘗試編譯。當編譯項目時,你已經找到了需要排除的庫。

相關問題