Android - Proguard 重复的 zip 条目错误

发布于 2025-01-05 09:32:50 字数 1136 浏览 0 评论 0原文

我试图在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帝王念 2025-01-12 09:32:50

问题中的更新 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.

揪着可爱 2025-01-12 09:32:50

如果您收到重复的 zip 条目,这就是它所说的意思,请打开罐子并检查是否有重复项。

例如,检查您的 build.xml 不包含类似的内容

<zipfileset src="${file.reference.joda-time-2.2.jar}" includes="**/*.class"/>
<zipfileset src="${file.reference.joda-time-2.2.jar}" includes="**/*"/>

这将包含 .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

<zipfileset src="${file.reference.joda-time-2.2.jar}" includes="**/*.class"/>
<zipfileset src="${file.reference.joda-time-2.2.jar}" includes="**/*"/>

That would include the .class files two times!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文