Android - Proguard duplicate zip entry error

人走茶凉 提交于 2019-12-17 20:17:09

问题


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.


回答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.




回答2:


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!



来源:https://stackoverflow.com/questions/9279213/android-proguard-duplicate-zip-entry-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!