Proguard warnings “can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry)”

后端 未结 5 1301
一整个雨季
一整个雨季 2020-11-30 02:52

I\'m using IntelliJ and running Proguard in debug mode but I can\'t seem to get rid of warnings such as:

ProGuard: [         


        
5条回答
  •  情歌与酒
    2020-11-30 03:51

    Possibly a 'proguard.cfg' problem. Does it include any '-injars'? If your project includes another project as a library, jars can be processed twice. Could you post your 'proguard.cfg'?

    Extract from http://proguard.sourceforge.net/index.html#manual/troubleshooting.html:

    Your input jars contain multiple resource files with the same name. ProGuard continues copying the resource files as usual, skipping any files with previously used names. Once more, the warning may be an indication of some problem though, so it's advisable to remove the duplicates. A convenient way to do so is by specifying filters on the input jars. There is no option to switch off these warnings.

    OPTION #1:

    As you can't post your '-injars', check if they include either 'android-support-v13.jar' or the library included in your project which itself also includes 'android-support-v13.jar'.

    Assuming you are building with Ant inside IntelliJ IDEA, you mustn't add -injars, -outjars, or -libraryjars options; the Ant script already does that for you.

    OPTION #2:

    Although the warnings are harmless, a clean build is a happy build, so try:

    http://web.archive.org/web/20160206204259/http://www.dancartoon.com/2012/01/14/fixing-proguard-warning-cant-write-resource-meta-infmanifest-mf/

    and

    https://gist.github.com/paulpv/4439012

    OPTION #3:

    Include (!META-INF/MANIFEST.MF) after each '-injars' command

    -injars library.jar(!META-INF/MANIFEST.MF)
    

    OPTION #4: Android Proguard Duplicate Definition

    Fixed this by moving the 3rd party libraries to another directory, in my case 'lib'. Then added

    -injars lib/jmdns.jar 
    

    to the proguard.cfg file.

    OPTION #5: Android - Proguard duplicate zip entry error

    If your Proguard config file includes the following line, remove it:

    -injars bin/classes
    

    OPTION #6: Android obfuscate app using proguard keeps obfuscating library jars - or is it?

    I found another way to make Proguard leave library jars alone was to ask it to preserve their package names, eg:

    -keep class javax.** { *; } -keep class org.** { *; } -keep class twitter4j.** { *; }

    OPTION #7:

    A weird solution (deleting META-INF folder in src folder) to something similar here.

提交回复
热议问题