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

北城余情 提交于 2019-12-03 09:59:29

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'
    }
}

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!