java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex

后端 未结 21 1296
孤街浪徒
孤街浪徒 2020-11-22 07:37

I am not sure what this error means.

Execution failed for task \':excelSior:packageAllDebugClassesForMultiDex\'.
> java.util.zip.ZipException: duplicate          


        
相关标签:
21条回答
  • 2020-11-22 08:29

    I also came across this kind issue when re import old eclipse project. It occurred some old dependency as jar file in the project.

    just remove

    compile fileTree(dir: 'libs', include: '*.jar')

    in gradle file

    and add dependency in the gradle file.

    It works for me ..

    0 讨论(0)
  • 2020-11-22 08:29

    In my case exact error was below

    ':android:transformClassesWithJarMergingForDebug'.

    com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqx.class

    I was using another version of google apis i.e. in one modules gradle file

    if (!project.hasProperty('gms_library_version')) {
            ext.gms_library_version = '8.6.0'
       }
    

    however in other modules version 11.6.0 as below

       compile "com.google.android.gms:play-services-ads:11.6.0"
        compile "com.google.android.gms:play-services-games:11.6.0"
        compile "com.google.android.gms:play-services-auth:11.6.0"
    

    However to find this i did a ctrl + n in android studio and entered class name zzqx.class and then it displayed 2 jar files being pulled for this class and then i understood that somewhere i am using version 8.6.0 . On changing 8.6.0 to 11.6.0 and rebuilding the project the issue was fixed .

    Hope this helps .

    More on this here https://www.versionpb.com/tutorials/step-step-tutorials-libgdx-basic-setup-libgdx/implementing-google-play-services-leaderboards-in-libgdx/

    0 讨论(0)
  • 2020-11-22 08:30

    In my case the mentioned "duplicate entry" error arised after settingmultiDexEnable=true in the build.gradle.

    and exact error which i was getting was below :

    Error:Execution failed for task 
    ':android:transformClassesWithJarMergingForDebug'.
    > com.android.build.api.transform.TransformException: 
    java.util.zip.ZipException: duplicate entry: 
    com/google/android/gms/internal/zzqx.class
    

    So first thing I search for class which causes "duplicate entry" error using ctrl+n in Android Studio and searched for com/google/android/gms/internal/zzqx.class and then it was showing 2 entries for gms class with one version 8.4.0 and 1 with version 11.6.0 .

    To fix it i made both to use 11.6.0 and it was fixed example

    earlier

        compile "com.google.android.gms:play-services-games:11.6.0"
        compile "com.google.android.gms:play-services-auth:8.4.0"
        compile "com.google.android.gms:play-services-ads:11.6.0"
    

    After

        compile "com.google.android.gms:play-services-games:11.6.0"
        compile "com.google.android.gms:play-services-auth:11.6.0"
        compile "com.google.android.gms:play-services-ads:11.6.0"
    

    Rebuilding Fixed .

    0 讨论(0)
提交回复
热议问题