12

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.

Community
  • 1
  • 1
500865
  • 6,920
  • 7
  • 44
  • 87

2 Answers2

4

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.

500865
  • 6,920
  • 7
  • 44
  • 87
  • 4
    my error is a little different, But I have no "-injars" clauses.please help me, tired of this! Proguard returned with error code 1. See console Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [android-support-v4.jar:META-INF/MANIFEST.MF]) Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [library.jar:META-INF/MANIFEST.MF]) – thecr0w Nov 16 '12 at 01:55
  • @l33t, sorry, it's been a long time and I can't tell you anything. – thecr0w Nov 08 '13 at 07:22
  • @TheHippo, maybe you can try this: copy the same android-support-v4.jar to where your libraries need. and plz let me know if it works or not. – thecr0w Feb 11 '14 at 03:28
  • 1
    @500865 i got this error.plz give me solution. can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [android-support-v4.jar:META-INF/MANIFEST.MF]) Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [library.jar:META-INF/MANIFEST.MF]) – dipali Jun 10 '15 at 05:21
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!

dendini
  • 3,842
  • 9
  • 37
  • 74