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

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

问题描述

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

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])

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

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!

推荐答案

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

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

http://proguard.sourceforge.net/index.html提取#manual/troubleshooting.html :

您的输入jar包含多个具有相同名称的资源文件. ProGuard继续照常复制资源文件,跳过任何 具有以前使用的名称的文件.再一次,警告可能是 指示出一些问题,因此建议删除 重复项.一种方便的方法是在 输入罐子.没有关闭这些警告的选项.

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.

选项1:

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

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

假定您正在IntelliJ IDEA中使用Ant进行构建,则不必添加-injars,-outjars或-libraryjars选项. Ant脚本已经为您完成了此任务.

选项2:

尽管警告是无害的,但干净的构建是一个令人满意的构建,因此请尝试:

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

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

选项3:

在每个"-injars"命令后添加(!META-INF/MANIFEST.MF)

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

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

选项4:: Android Proguard重复定义

通过将第三方库移动到另一个目录中来解决此问题 我的情况是"lib".然后添加

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

-injars lib/jmdns.jar 

到proguard.cfg文件.

to the proguard.cfg file.

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

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

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

-injars bin/classes

选项#6::

我发现让Proguard独自留下图书馆罐子的另一种方法是 要求它保留其软件包名称,例如:

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

-保持类javax.** {*; } -keep class org.** {*; } -保持类twitter4j.​​* {*; }

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

选项#7:

类似于类似此处的东西的怪异解决方案(在src文件夹中删除了META-INF文件夹).

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

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

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