How to resolve java.util.zip.ZipException?

后端 未结 11 1113
执念已碎
执念已碎 2020-11-27 05:37

Whever I try to debug and deploy my android application (in Android Studio 0.9) I get the following error:

Execution failed for task \':app:packageAllDebugCl         


        
相关标签:
11条回答
  • 2020-11-27 05:54

    This type of error like duplicate entry occurs when you some class is at more than one place. To overcome this problem , Simple search the class which shows duplicate entry in project. It will show you all paths where this class present more than one place. In Windows CNTRL+N is keyboard shortcut for search in files. Simple try to remove one of the lib or file and the problem is solved.

    0 讨论(0)
  • 2020-11-27 05:55

    I recently had this error, and after looking at my "External Libraries" in Android studio, it turns out one of my libraries had been included under two version numbers. (In this case it was wire-runtime 1.5.1 and 1.5.2).

    What I would recommend is to look inside "External Libraries" in your Project view, and see if there are any redundant libraries there. It includes transitive dependencies as well so you might find something there that surprises you.

    0 讨论(0)
  • 2020-11-27 05:58

    Edit: This is a bug and a fix is due. See https://code.google.com/p/android/issues/detail?id=81804

    I have this problem too, and I don't have an answer. But here's what I can add:

    The class BuildConfig is a magic class generated as part of the build process. For some reason, there exists a version with the same fully-qualified name (android.support.multidex.BuildConfig) in both mutildex-1.0.0 and multidex-instrumentation-1.0.0 aars.

    I don't believe we have done anything wrong. I think this is a symptom of being on the cutting-edge. I raised a bug report.

    0 讨论(0)
  • 2020-11-27 05:58

    If you enable multiDex, you should stop doing the logic in afterEvaluate {}. The multi-dex support will take care of the main dex list for you.

    0 讨论(0)
  • 2020-11-27 06:00

    To diagnose and fix this problem, run this gradle command:

    ./gradlew clean app:dependencies
    

    this will list all of the dependencies in your app in a tree. Search the results for the offending duplicate class and add

    compile('naughty.library') {
        exclude group: 'foo', module: 'bar'
    }
    

    to remove the duplicate.

    0 讨论(0)
  • 2020-11-27 06:13

    In my case the reason was Facebook Android SDK. Just exclude transitive dependency:

    compile('com.facebook.android:facebook-android-sdk:+') {
        exclude group: 'com.android.support', module: 'multidex'
    }
    

    In your case it can be some other dependency - just sort through them one by one and you'll find the one who has transitive multidex dependency.

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