Android - Proguard 重复的 zip 条目错误
我试图在使用 android 库项目的 android 应用程序中使用 proguard,但出现以下错误:
java.io.IOException: Can't write
[/private/var/folders/Pg/PgUpPJQ-E5qxL7jX6kpdCE+++TI/-Tmp-/android_3140050575281008652.jar]
(Can't read [proguard.ClassPathEntry@1f8d244]
(Duplicate zip entry
[be.class == android_144638064543155619.jar:com/comp/dp/library/R$anim.class]))
at proguard.OutputWriter.writeOutput(OutputWriter.java:224)
at proguard.OutputWriter.execute(OutputWriter.java:120)
at proguard.ProGuard.writeOutput(ProGuard.java:391)
at proguard.ProGuard.execute(ProGuard.java:152)
at proguard.ProGuard.main(ProGuard.java:499)
我的 proguard.cfg 文件是 这个以及一些引用rt.jar
的-libraryjars
和其他几个依赖库。
我的猜测是,这个问题与使用库项目有关,并且 proguard 正在尝试处理来自库项目的条目两次。但我不确定应该使用哪些选项来解决这个问题。
非常感谢任何建议/指示。
更新1:通过删除-injars bin/classes
我能够解决这个问题。我的猜测是,因为 proguard 同时处理库项目和应用程序项目,所以库项目的 .class 文件被处理了两次。一次位于库项目的 bin/classes
文件夹中,另一次位于应用程序项目的 bin/classes
文件夹中。
I am trying to use proguard in an android application which uses a android library project and I am getting the following error :
java.io.IOException: Can't write
[/private/var/folders/Pg/PgUpPJQ-E5qxL7jX6kpdCE+++TI/-Tmp-/android_3140050575281008652.jar]
(Can't read [proguard.ClassPathEntry@1f8d244]
(Duplicate zip entry
[be.class == android_144638064543155619.jar:com/comp/dp/library/R$anim.class]))
at proguard.OutputWriter.writeOutput(OutputWriter.java:224)
at proguard.OutputWriter.execute(OutputWriter.java:120)
at proguard.ProGuard.writeOutput(ProGuard.java:391)
at proguard.ProGuard.execute(ProGuard.java:152)
at proguard.ProGuard.main(ProGuard.java:499)
My proguard.cfg file is this along with a few -libraryjars
referring to rt.jar
and couple of other dependent libraries.
My guess is that this problem is something related to using the Library Project and that proguard is trying to process entry from the library project twice. But I was not sure which options I should use to fix this.
Any suggestions/directions are much appreciated.
Update 1 : By removing the -injars bin/classes
I was able to get through with this problem. My guess was that because proguard process both library project and the application project the .class
files of the library project was processed twice. Once in the library project's bin/classes
folder and another time in the application project's bin/classes
folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题中的更新 1 解决了我的问题,我现在可以运行我的应用程序。
这个答案只是将问题标记为已回答,我可以在两天后完成。
The Update 1 in the question has solved my problem and I am now able to run my application.
This answer is just to mark the question as answered which I can do after two days.
如果您收到重复的 zip 条目,这就是它所说的意思,请打开罐子并检查是否有重复项。
例如,检查您的 build.xml 不包含类似的内容
这将包含 .class 文件两次!
If you get duplicate zip entry it means what it says, open the jar and check for duplicates.
For instance check your build.xml doesn't contain anything like
That would include the .class files two times!