Search code examples
androidproguardadt

How to troubleshoot "Duplicate zip entry" error?


I keep getting this error when switching from a previous project to this project and then trying to export it:

Proguard returned with error code 1. See console
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [modonelib.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [mymainlib.jar:META-INF/MANIFEST.MF])
java.io.IOException: Can't write [C:\Users\ih8ie8\AppData\Local\Temp\android_8070931993503351509.jar] (Can't read [C:\workspace\MyMainLib\bin\mymainlib.jar] (Unexpected end of ZLIB input stream))
    at proguard.OutputWriter.writeOutput(OutputWriter.java:264)
    at proguard.OutputWriter.execute(OutputWriter.java:160)
    at proguard.ProGuard.writeOutput(ProGuard.java:372)
    at proguard.ProGuard.execute(ProGuard.java:153)
    at proguard.ProGuard.main(ProGuard.java:492)
Caused by: java.io.IOException: Can't read [C:\workspace\MyMainLib\bin\mymainlib.jar] (Unexpected end of ZLIB input stream)
    at proguard.InputReader.readInput(InputReader.java:230)
    at proguard.InputReader.readInput(InputReader.java:200)
    at proguard.OutputWriter.writeOutput(OutputWriter.java:253)
    ... 4 more
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
    at java.util.zip.InflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.util.zip.ZipInputStream.read(Unknown Source)
    at java.util.zip.ZipInputStream.closeEntry(Unknown Source)
    at java.util.zip.ZipInputStream.getNextEntry(Unknown Source)
    at proguard.io.JarReader.read(JarReader.java:58)
    at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
    at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
    at proguard.InputReader.readInput(InputReader.java:226)
    ... 6 more

If I exit and restart Eclipse twice, then repeat the same exact procedure, the problem goes away.

While I am able to eventually build a deploy-able app, I prefer getting rid of this error once and for all (it doesn't happen with other apps that I have in my workspace).

Any idea how to troubleshoot this?

Where do I look to find this "duplicate zip entry"?


Solution

  • The Eclipse build process creates an intermediary jar C:\workspace\MyMainLib\bin\mymainlib.jar, which ProGuard subsequently reads as input jar. At that point, it spuriously seems to be truncated. Maybe there are problems with the file system? You can check if the intermediary jar isn't corrupt, after the build. If it is ok, the problem might be that the file hasn't been flushed to disk when ProGuard reads it. The only workaround I see is to use Ant to perform the release build.