Home » Android » android – Proguard returned with error code 1. After update from ADT 16 to 18

android – Proguard returned with error code 1. After update from ADT 16 to 18

Posted by: admin May 14, 2020 Leave a comment

Questions:

I used to have Proguard 4.6 working perfectly to export signed applications on Eclipse 3.6.2.

But once I updated my ADT + SDK from 16.0.0.v201112150204-238534 to 18.0.0.v201203301601-306762 I can no longer export signed applications (debug version works fine). Instead I receive the following error log in the console:

Proguard returned with error code 1. See console
java.io.IOException: Can't read [\bta\wspc\LibProj1\bin\libproj1.jar] (Can't process class [com/bta/blib/proj1/BtClsProj1.class] (Unexpected end of ZLIB input stream))
    at proguard.InputReader.readInput(InputReader.java:230)
    at proguard.InputReader.readInput(InputReader.java:200)
    at proguard.InputReader.readInput(InputReader.java:178)
    at proguard.InputReader.execute(InputReader.java:78)
    at proguard.ProGuard.readInput(ProGuard.java:196)
    at proguard.ProGuard.execute(ProGuard.java:78)
    at proguard.ProGuard.main(ProGuard.java:492)
Caused by: java.io.IOException: Can't process class [com/bta/blib/proj1/BtClsProj1.class] (Unexpected end of ZLIB input stream)
    at proguard.io.ClassReader.read(ClassReader.java:112)
    at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
    at proguard.io.JarReader.read(JarReader.java:65)
    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
Caused by: java.lang.RuntimeException: Unexpected end of ZLIB input stream
    at proguard.classfile.io.RuntimeDataInput.readInt(RuntimeDataInput.java:136)
    at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:77)
    at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
    at proguard.io.ClassReader.read(ClassReader.java:91)
    ... 11 more

I searched SO for clues but the only related thread I’ve been able to find is about Proguard 4.7 with Eclipse SDK 3.7.1 with some reference to “Samsung’s SPen SDK 1.5” which I clearly don’t have.

Any idea what could be causing this and how to fix the problem?

How to&Answers:

I solved it by switching from OpenJDK 7 back to Sun JDK 6.

Update:

The problem came back using JDK 6.
My current solution: turn off Project -> Build Automatically when exporting.

Answer:

Problem solved by updating Proguard to the latest 4.8.

UPDATE: While updating to Proguard 4.8 solved the problem, it re-occurred in another project that is almost identical to the one that first exhibited the problem (it uses same library project). Knowing that the entire environment is identical I didn’t know why this was happening (and why Proguard is so inconsistent). After about two hours of chasing my tail, I finally had a guess: The proguard.cfg file was not edited via Eclipse, but rather via WinMerge. As soon as I copied over the (identical!) proguard.cfg from the working project, the problem disappeared.

Apparently, Proguard has a problem with CRLF vs. LF.

Answer:

The error message suggests that an input jar that is passed to ProGuard is corrupt. You can easily check this after the failed build. Maybe your disk partition is full.

Answer:

This can occur because a file has been changed since the last time you tested the project so the project may not be built fully. Clean and run the project on a device and then try exporting.

Answer:

problem solved by commenting the line in project.propterties i.e

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt