Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Proguard duplicate zip entry error

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.

like image 784
500865 Avatar asked Feb 14 '12 15:02

500865


2 Answers

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.

like image 165
500865 Avatar answered Sep 22 '22 15:09

500865


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!

like image 37
dendini Avatar answered Sep 21 '22 15:09

dendini