有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

安卓如何修复java。util。拉链ZipException:重复条目:com/google/firebase/FirebaseApiNotAvailableException。班

我得到一个错误: 错误:任务“:app:transformClassesWithJarMergingForRelease”的执行失败

com.安卓.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/FirebaseApiNotAvailableException.class

代码为:

dependencies {
compile 'com.安卓.support:support-v4:24.0.0'
compile 'com.安卓.support:appcompat-v7:24.0.0'
compile 'com.安卓.support:mediarouter-v7:24.0.0'
compile(files('libs/play-hub-support.jar'))

compile('com.google.安卓.gms:play-services-cast:8.3.0') {
    exclude group: 'com.google.安卓.gms'
}
compile('com.google.安卓.gms:play-services-analytics:8.3.0') {
    exclude group: 'com.google.安卓.gms'
}
compile('com.google.安卓.gms:play-services-auth:9.0.2') {
    exclude group: 'com.google.安卓.gms'
}
compile('com.google.安卓.gms:play-services-ads:11.2.0') {
    exclude group: 'com.google.安卓.gms'
}

compile 'com.安卓.support:multidex:1.0.1'
compile 'com.larswerkman:HoloColorPicker:1.5'

}


共 (2) 个答案

  1. # 1 楼答案

    对所有播放服务使用相同的版本

  2. # 2 楼答案

    不要使用不同版本的Google Play服务和Firebase

    compile('com.google.android.gms:play-services-cast:8.3.0')
    compile('com.google.android.gms:play-services-analytics:8.3.0')
    compile('com.google.android.gms:play-services-auth:9.0.2')
    compile('com.google.android.gms:play-services-ads:11.2.0')
    

    使用最新版本但不排除它们本身(*):

    compile('com.google.android.gms:play-services-cast:11.4.0')
    compile('com.google.android.gms:play-services-analytics:11.4.0')
    compile('com.google.android.gms:play-services-auth:11.4.0')
    compile('com.google.android.gms:play-services-ads:11.4.0')
    

    (*)这个exclude没有意义。在依赖项中删除它

    exclude group: 'com.google.android.gms'