Java.util.zip.ZipException:重复条目:com/google/common/base/FinalizableReference.class

Abh*_*ngh 5 android android-gradle-plugin

为什么我收到此错误时,我同步Gradle时不会发生,但是当我运行项目时,我收到此错误.

错误:任务':app:transformClassesWithJarMergingForRelease'的执行失败.> com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/common/base/FinalizableReference.class

我不知道哪个依赖项导致此错误,我的依赖项是.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:customtabs:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:percent:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.facebook.android:facebook-android-sdk:4.19.0'
    compile 'com.google.android.gms:play-services-auth:11.0.0'
    compile 'com.google.android.gms:play-services-location:11.0.0'
    compile 'com.google.android.gms:play-services-maps:11.0.0'
    compile 'com.google.android.gms:play-services-places:11.0.0'
    compile 'com.google.maps.android:android-maps-utils:0.3.4'
    compile 'io.nlopez.smartlocation:library:3.3.1'
    compile 'com.appeaser.sublimenavigationviewlibrary:sublimenavigationviewlibrary:0.0.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.afollestad:sectioned-recyclerview:0.4.1'
    compile 'com.github.medyo:fancybuttons:1.8.3'
    compile 'com.basgeekball:awesome-validation:2.0'
    compile 'com.github.michaelye.easydialog:easydialog:1.4'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

编辑

我认为播放服务依赖导致了这个问题.当我使用10.2.6而不是11.0.0应用程序工作完美时,我只是将dependecies更改为

compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-places:10.2.6'
Run Code Online (Sandbox Code Playgroud)

但我想使用最新版本的播放服务,11.0.0但它给了我上述问题.如何解决这个问题?任何帮助将是appriciated谢谢.

Abh*_*ngh 7

最后问题解决了.好像它是一个bug谷歌在更新版本中解决了这个问题.

使用播放服务版本 11.0.1

在项目级别使用gradle

classpath 'com.google.gms:google-services:3.1.0'

  • @Abhishek Singh我似乎无法找到Google Play Services v11.0.1,如果我把它放在我的gradle文件中它说它无法找到它并且不会构建,我在[Google website]上看不到它](https://developers.google.com/android/guides/releases).您是否在使用某种测试版更新频道?暂时我已恢复到10.2.6,这可以正常工作. (2认同)