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

后端 未结 21 1304
孤街浪徒
孤街浪徒 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:27

    My understanding is that there are duplicate references to the same API (Likely different version numbers). It should be reasonably easy to debug when building from the command line.

    Try ./gradlew yourBuildVariantName --debug from the command line.

    The offending item will be the first failure. An example might look like:

    14:32:29.171 [INFO] [org.gradle.api.Task] INPUT: /Users/mydir/Documents/androidApp/BaseApp/build/intermediates/exploded-aar/theOffendingAAR/libs/google-play-services.jar
    
    14:32:29.171 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':BaseApp:packageAllyourBuildVariantNameClassesForMultiDex'
    
    14:32:29.172 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :BaseApp:packageAllyourBuildVariantNameClassesForMultiDex FAILED'
    

    In the case above, the aar file that I'd included in my libs directory (theOffendingAAR) included the Google Play Services jar (yes the whole thing. yes I know.) file whilst my BaseApp build file utilised location services:

    compile 'com.google.android.gms:play-services-location:6.5.87'
    

    You can safely remove the offending item from your build file(s), clean and rebuild (repeat if necessary).

提交回复
热议问题