Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Proguard警告:can';t写入资源(重复的zip条目)_Android_Android Proguard - Fatal编程技术网

Android Proguard警告:can';t写入资源(重复的zip条目)

Android Proguard警告:can';t写入资源(重复的zip条目),android,android-proguard,Android,Android Proguard,我启用了proguard并获得: Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/LICENSE.txt]) Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/NOTICE.txt]) War

我启用了proguard并获得:

Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/NOTICE.txt])
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-collections-3.2.1.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [commons-collections-3.2.1.jar:META-INF/NOTICE.txt])
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [joda-time-2.7-no-tzdb.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [joda-time-2.7-no-tzdb.jar:META-INF/NOTICE.txt])
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-primitives-1.0.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/services/javax.annotation.processing.Processor] (Duplicate zip entry [icepick-processor-2.3.6.jar:META-INF/services/javax.annotation.processing.Processor])
Warning:can't write resource [.readme] (Duplicate zip entry [classes.jar:.readme])
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-lang-2.6.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [commons-lang-2.6.jar:META-INF/NOTICE.txt])
这是什么意思? 我应该排除像这里这样的东西吗

configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
}

您正在使用一个包含重复文件的库,这是gradle中的一个bug,为了解决这个问题,请在您的项目build.gradle中使用它

android {
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude '.readme'
    }
}

在proguard配置文件中添加选项
-ignorewarnings
对我来说很有效。它仍然会对“META-INF/LICENSE.txt”发出警告,但构建不会失败。但只有在确定其影响时,才使用此选项。如需更多信息,请按以下步骤操作。

来自:

警告:无法写入资源。。。重复的邮政编码条目

您的输入jar包含多个同名的资源文件。 ProGuard继续照常复制资源文件,跳过任何 具有以前使用过的名称的文件。同样,警告可能是错误的 但有一些问题的迹象,因此建议移除 复制品。一种方便的方法是在 输入罐。没有关闭这些警告的选项

标准的Android构建过程会自动为您指定输入jar。可能没有一种简单的方法可以过滤掉它们 这些警告。您可以手动删除重复的资源文件 来自输入和库


这没用。尝试了打包选项{exclude'META-INF/DEPENDENCIES'exclude'META-INF/NOTICE'exclude'META-INF/LICENSE'exclude'META-INF/LICENSE.txt'exclude'META-INF/NOTICE.txt},但也没有帮助。对我有用!谢谢我喜欢干净的身材。:)添加这些行后发布logcat并发布您的构建。gradle出于某种原因,
排除“.readme”
不会删除警告。PackageOptions应用于package*任务,而上面的警告来自proguard,它在发布构建类型中打包之前运行。看,是的,但我们的想法是不要有警告!但是我不能手动删除它们,因为它们在libs中,所以看起来没有办法这样做?