Android Proguard warning: can't write resource (Duplicate zip entry)

前端 未结 3 1908
余生分开走
余生分开走 2021-02-12 16:24

I enabled proguard and got:

Warning:can\'t write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/LICENSE.txt])
Warning:can\'t w         


        
相关标签:
3条回答
  • 2021-02-12 16:57

    From Proguard manual:

    Warning: can't write resource ... Duplicate zip entry

    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.

    The standard Android build process automatically specifies the input jars for you. There may not be an easy way to filter them to remove these warnings. You could remove the duplicate resource files manually from the input and the libraries.

    0 讨论(0)
  • 2021-02-12 16:59

    Adding option -ignorewarnings in the proguard config file worked for me. It still gives warning for 'META-INF/LICENSE.txt' but build does not fail. But use this option only if you are sure about what are its effects. Follow http://proguard.sourceforge.net/manual/usage.html#ignorewarnings for more info.

    0 讨论(0)
  • 2021-02-12 17:15

    You are using a library with duplicate files, is a bug in gradle, for solve use this in your project build.gradle

    android {
        packagingOptions {
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude '.readme'
        }
    }
    
    0 讨论(0)
提交回复
热议问题