ZipException:重复输入:com / google / android / gms / internal / measurement / zzwn.class

时间:2018-08-09 17:39:47

标签: android react-native

出了什么问题: 任务':app:transformClassesWithJarMergingForRelease'的执行失败。

  

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / internal / measurement / zzwn.class

我试图创建一个任务来删除重复项,但是没有成功。

此任务:

task findDuplicates {
    doLast {
        def findMe = 'com/google/android/gms/internal/measurement/zzwn.class'
        configurations.compile.asFileTree.matching {
            include '**/*.jar'
        }.files.each { File jarFile ->
            zipTree(jarFile).visit { FileVisitDetails fvd ->
                if (fvd.path == findMe) {
                    println "Found $findMe in $jarFile.name"
                }
            }
        }
    }
}

我的依赖项:

dependencies {
    compile project(':react-native-fast-image')
    compile project(':react-native-facebook-login')
    compile project(':realm')
    compile project(':react-native-sqlite-storage')
    compile project(':react-native-device-info')
    compile project(':react-native-splash-screen')
    compile project(':react-native-vkontakte-login')
    compile project(':react-native-google-analytics-bridge')
    compile project(':react-native-custom-tabs')
    compile project(':react-native-onesignal')
    compile project(':react-native-fabric')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.facebook.react:react-native:+'  // From node_modules
    compile 'com.facebook.fresco:animated-gif:1.9.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true;
    }
}

1 个答案:

答案 0 :(得分:2)

我发现react-native-google-analytics-bridgereact-native-onesignal之间存在冲突,我在compile 'com.google.firebase:firebase-messaging:17.1.0'中添加了依存关系app/build.gradle

我希望这会对某人有所帮助。