簡體   English   中英

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

[英]com.android.build.api.transform.TransformException:

為什么我會收到這個錯誤,它不會在我同步 gradle 時發生,但是當我運行項目時我會收到這個錯誤。

任務“:app:transformClassesWithJarMergingForDebug”執行失敗。

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重復條目:com/google/android/gms/common/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;
}

}

此類問題通常是由您的某些依賴項的內部依賴項引起的。 所以你需要從你的依賴中排除沖突的依賴。 但在大多數情況下,您作為開發人員不知道您需要從哪個庫中排除。

所以只需嘗試將exclude group: "com.google.android.gms"一一添加到所有庫中並嘗試編譯。 編譯項目時,您已找到要排除的所需庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM