2

I wanted my app to be progaurd protected. For this i went thru some tutorials, posts and at last from this post i came to know that i should only do this:

If you're using ADT 17 or newer, the documentation is slightly inaccurate. The generated file is proguard-project.txt and will be in the root directory of your project.

To enable Proguard, you will need to ignore the "do not modify" warning in project.properties and uncomment the following line:

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

After uncommeting the above suggested line i tried to export the unsigned application. But got an export error saying progaurd returned error with code 1 . When i clicked the details button on the error dialog, i got the error log shown below:

Proguard returned with error code 1. See console
Proguard Error 1 
Output: 
      You should check if you need to specify additional program jars. 
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [acra-

4.4.0.jar:META-INF/MANIFEST.MF]) 
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry 

[libGoogleAnalyticsV2.jar:META-INF/MANIFEST.MF]) 
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [google-play-

services_lib.jar:META-INF/MANIFEST.MF]) 
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry 

[vpilibrary.jar:META-INF/MANIFEST.MF]) 
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry 

[abslibrary.jar:META-INF/MANIFEST.MF]) 
java.io.IOException: Can't write [C:\Users\SURESH\AppData\Local\Temp

\android_6223056648746329994.jar] (Can't read [C:\Users\SURESH\Desktop\ActionBarSherlock-

4.2.0\ABSlibrary\bin\abslibrary.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:\Users\SURESH\Desktop\ActionBarSherlock-

4.2.0\ABSlibrary\bin\abslibrary.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(InflaterInputStream.java:223) 
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141) 
    at java.util.zip.ZipInputStream.read(ZipInputStream.java:154) 
    at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100) 
    at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:78) 
    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

Any idea why is this happening? am i correctly configuring progaurd or missing out steps?

Community
  • 1
  • 1
suresh cheemalamudi
  • 6,190
  • 11
  • 49
  • 67

2 Answers2

1

The root cause is listed in the stack trace:

Caused by: java.io.IOException: Can't read [C:\Users\SURESH\Desktop\ActionBarSherlock-4.2.0\ABSlibrary\bin\abslibrary.jar] (Unexpected end of ZLIB input stream)
...
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream 
    at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
    ...

You should check the following:

  • Is the file abslibrary.jar present at the given location?
  • Is it a valid jar (can you open it with some unzipping tool)?
  • Is it being written during the build process? If it somehow is being written asynchronously, it might still be incomplete when ProGuard reads it.
Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
  • actually i got the above error only for the first time. When i tried it to export for the second time, it got exported normally and i continued with the signing process. After completing signing process i tried to test the app on a device and app got crashed immediately on launch. this is the logcat message on crash http://pastebin.com/TWbjsNp3 – suresh cheemalamudi Feb 11 '13 at 06:03
  • @suresh That's a different question. The field SILENT is accessed by reflection. You should preserve it with a -keep option. See the ProGuard manual. – Eric Lafortune Feb 14 '13 at 09:38
  • I get the same error if my android app refers to another android library project when ProGuard processes. – Alanmars Apr 17 '14 at 06:22
0

I solve the problem by annotation -libraryjars about the jar that can't found.The document say is will not present jar,it will load the jar in run time.

Snow Albert
  • 547
  • 7
  • 15