java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbq.class

拜拜、爱过 提交于 2019-11-29 13:55:12

The reason behind that may be you have include two different versions for gms. Also if you have included the complete package then there is no need to include the second 'compile 'com.google.android.gms:play-services:7.5.0'' If you need only auth services from google then dont include the complete package it ll exceed 65k methods and duplicacy chances will be there. Include this

compile 'com.google.android.gms:play-services-auth:9.4.0'

and from your code remove

compile 'com.google.android.gms:play-services-auth:9.2.1' compile 'com.google.android.gms:play-services:7.5.0'

Execute it and let me know once.

In my case, it's because of the

compile 'com.facebook.android:audience-network-sdk:4.+'

I change it to this:

 compile ('com.facebook.android:audience-network-sdk:4.+'){
        exclude group:"com.google.android.gms"
    }

No more problem!

If you are using Firebase, you should read my solution. In my case I developed a new app. This new app has ads, so I put compile 'com.google.firebase:firebase-ads:11.0.4' BEFORE compile 'com.google.firebase:firebase-core:11.0.4'.

But either you have to put everything AFTER firebase-core or it's about the version number 11.0.4 that have to be the same on all firebase modules you are using.

Excluding com.google.android.gms from the offending package worked to build the project for me, but unfortunately the app would crash during initialization. The solution for me was to upgrade all firebase dependencies from 11.6.0 to 11.8.0, ie:

- compile "com.google.android.gms:play-services-base:11.6.0"
- compile "com.google.firebase:firebase-core:11.6.0"
- compile "com.google.firebase:firebase-messaging:11.6.0"
- compile "com.google.firebase:firebase-analytics:11.6.0"
- compile "com.google.firebase:firebase-ads:11.6.0"

+ compile "com.google.android.gms:play-services-base:11.8.0"
+ compile "com.google.firebase:firebase-core:11.8.0"
+ compile "com.google.firebase:firebase-messaging:11.8.0"
+ compile "com.google.firebase:firebase-analytics:11.8.0"
+ compile "com.google.firebase:firebase-ads:11.8.0"

The problem was only presenting itself when adding firebase-ads but this fixed it.

Please be sure that you are using identical versions of com.google.gms. You can run the next command from the project root dir to find out which versions are used:

./gradlew :<subproject>:dependencies

Usually it is something like this:

./gradlew :app:dependencies 

After analyzing you are able to set the same versions or exclude group from some modules or expose a version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!