繁体   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