Proguard 警告“无法写入资源 [META-INF/MANIFEST.MF](重复的 zip 条目)" [英] Proguard warnings "can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry)"

查看:34
本文介绍了Proguard 警告“无法写入资源 [META-INF/MANIFEST.MF](重复的 zip 条目)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 IntelliJ 并在调试模式下运行 Proguard,但我似乎无法摆脱以下警告:

ProGuard: [MyApplication] 警告:无法写入资源 [META-INF/MANIFEST.MF](重复的 zip 条目 [android-support-v13.jar:META-INF/MANIFEST.MF])

这个项目有几个模块,其中两个使用了 android-support-v13.jar.我认为这是问题所在,因此我从 libs 文件夹中删除了该库,将其添加为项目库并将依赖项添加到两个模块中.这没有解决任何问题,警告仍然存在,我不明白为什么.

我知道这些警告不会影响任何事情,但干净的构建是一个快乐的构建!

解决方案

可能是 'proguard.cfg' 问题.它包括任何'-injars'吗?如果您的项目包含另一个项目作为库,则可以处理 jar 两次.你能发布你的'proguard.cfg'吗?

摘自 http://proguard.sourceforge.net/index.html#manual/troubleshooting.html:

<块引用>

您的输入 jar 包含多个同名的资源文件.ProGuard 继续像往常一样复制资源文件,跳过任何以前使用过的名称的文件.再一次,警告可能是虽然表明存在一些问题,因此建议删除重复.一种方便的方法是在输入罐.无法关闭这些警告.

选项 1:

由于您无法发布您的-injars",请检查它们是否包含android-support-v13.jar"或您的项目中包含的库,该库本身也包含android-support-v13.jar".

假设您在 IntelliJ IDEA 中使用 Ant 进行构建,则不得添加 -injars、-outjars 或 -libraryjars 选项;Ant 脚本已经为您做到了这一点.

选项 2:

虽然警告是无害的,但干净的构建是一个快乐的构建,所以尝试:

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

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

选项 3:

在每个'-injars'命令之后包含(!META-INF/MANIFEST.MF)

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

选项 #4: Android Proguard 重复定义><块引用>

通过将第 3 方库移动到另一个目录来解决此问题,在我的情况'lib'.然后添加

-injars lib/jmdns.jar

到 proguard.cfg 文件.

选项 #5: Android - Proguard 重复 zip 条目错误

如果您的 Proguard 配置文件包含以下行,请将其删除:

-injars bin/classes

选项 #6: 使用 proguard 的 Android 混淆应用程序不断混淆库 jar - 或者是吗?

<块引用>

我找到了另一种让 Proguard 离开图书馆罐子的方法是要求它保留他们的包名,例如:

-保持类 javax.** { *;}-保持类组织.** { *;}-保持类 twitter4j.** { *;}

选项 #7:

一个奇怪的解决方案(删除 src 文件夹中的 META-INF 文件夹)类似于here.

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

ProGuard: [MyApplication] Warning: can't write resource [META-INF/MANIFEST.MF] 
(Duplicate zip entry [android-support-v13.jar:META-INF/MANIFEST.MF])

This project has a couple of modules and android-support-v13.jar is being used on 2 of them. I thought that was the issue so I removed that library from the libs folder, added it as a project library and added the dependency to both modules. That didn't solve anything, the warning persists and I don't understand why.

I know these warnings don't affect anything but a clean build is a happy build!

解决方案

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.

这篇关于Proguard 警告“无法写入资源 [META-INF/MANIFEST.MF](重复的 zip 条目)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆