如何修复java.util.zip.ZipException:重复条目:com/google/firebase/FirebaseApiNotAvailableException.class?

如何修复java.util.zip.ZipException:重复条目:com/google/firebase/FirebaseApiNotAvailableException.class?,java,android,google-play-services,Java,Android,Google Play Services,我得到一个错误: 错误:任务“:app:transformClassesWithJarMergingForRelease”的执行失败 com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/google/firebase/FirebaseApiNotAvailableException.class 代码为: dependencies { compile 'com.android

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

com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/google/firebase/FirebaseApiNotAvailableException.class

代码为:

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

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

compile 'com.android.support:multidex:1.0.1'
compile 'com.larswerkman:HoloColorPicker:1.5'

}

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

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

不要使用不同版本的Google play services和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 group: 'com.google.android.gms'

不要使用不同版本的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 group: 'com.google.android.gms'

播放服务v11取决于支持库v26。将所有支持库版本更改为26.1.0,并将CompileSDK版本更改为26。您可以保留当前的targetSdkVersion。不要从com.google.android.gms库中排除组:“com.google.android.gms!”!这些库有自己的依赖项,如果您这样做,您的应用程序将在运行时崩溃。播放服务v11取决于支持库v26。将所有支持库版本更改为26.1.0,并将CompileSDK版本更改为26。您可以保留当前的targetSdkVersion。不要从com.google.android.gms库中排除组:“com.google.android.gms!”!这些库有它们自己的依赖项,如果您这样做,您的应用程序将在运行时崩溃……Firebase,可能……和Firebase,可能。