0

Firstly, sorry for my bad english!

I've made an Android/PhoneGap application and i'm trying to export it for google play store but Eclipse throw me the error 'Conversion to Dalvik format failed with error 1'.

So i've searched a lot of information about it and it's because i use a third library (BarCodeScanner) wich also includes the same .jars files than my 'main' project.

When i tried to 'Remove from build path' in BareCodeScanner the 'Google APIs [Android 4.2.2]' and 'Clean', Apk generate fine but unfortunately the scanner doesn't works and freeze the app. I've also try to uncomment proguard lines on the third library and main project but the error coming again.

Please how can i fix it ? I've tried many things. Rebuild project etc..

Ps: Works fine in debug flow.

Wanted to post an img of my project explorer for help you but i need 10 reputation.

Proguard errors log

Proguard returned with error code 1. See console [2013-06-06 18:19:47 - ecocompare] java.io.IOException: Can't read [C:\Users\Dell\Desktop\BarcodeScanner\2.2.0\LibraryProject\bin\captureactivity.jar] (Can't process class [com/google/zxing/client/android/result/supplement/URIResultInfoRetriever.class] (Unexpected end of ZLIB input stream)) [2013-06-06 18:19:47 - ecocompare] at proguard.InputReader.readInput(InputReader.java:230) [2013-06-06 18:19:47 - ecocompare] at proguard.InputReader.readInput(InputReader.java:200) [2013-06-06 18:19:47 - ecocompare] at proguard.InputReader.readInput(InputReader.java:178) [2013-06-06 18:19:47 - ecocompare] at proguard.InputReader.execute(InputReader.java:78) [2013-06-06 18:19:47 - ecocompare] at proguard.ProGuard.readInput(ProGuard.java:196) [2013-06-06 18:19:47 - ecocompare] at proguard.ProGuard.execute(ProGuard.java:78) [2013-06-06 18:19:47 - ecocompare] at proguard.ProGuard.main(ProGuard.java:492) [2013-06-06 18:19:47 - ecocompare] Caused by: java.io.IOException: Can't process class [com/google/zxing/client/android/result/supplement/URIResultInfoRetriever.class] (Unexpected end of ZLIB input stream) [2013-06-06 18:19:47 - ecocompare] at proguard.io.ClassReader.read(ClassReader.java:112) [2013-06-06 18:19:47 - ecocompare] at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87) [2013-06-06 18:19:47 - ecocompare] at proguard.io.JarReader.read(JarReader.java:65) [2013-06-06 18:19:47 - ecocompare] at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65) [2013-06-06 18:19:47 - ecocompare] at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53) [2013-06-06 18:19:47 - ecocompare] at proguard.InputReader.readInput(InputReader.java:226) [2013-06-06 18:19:47 - ecocompare] ... 6 more [2013-06-06 18:19:47 - ecocompare] Caused by: java.lang.RuntimeException: Unexpected end of ZLIB input stream [2013-06-06 18:19:47 - ecocompare] at proguard.classfile.io.RuntimeDataInput.readInt(RuntimeDataInput.java:136) [2013-06-06 18:19:47 - ecocompare] at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:77) [2013-06-06 18:19:47 - ecocompare] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) [2013-06-06 18:19:47 - ecocompare] at proguard.io.ClassReader.read(ClassReader.java:91) [2013-06-06 18:19:47 - ecocompare] ... 11 more

Alex Filatov
  • 2,232
  • 3
  • 32
  • 39
gmourier
  • 334
  • 3
  • 13
  • Check if your `BarCodeScanner` requires any obfuscator settings (proguard). – Trinimon Jun 06 '13 at 16:13
  • @Trinimon Im a newbie with proguard, i know it since today. Anyways BarCodeScanner has a proguard setting file. – gmourier Jun 06 '13 at 16:34
  • I'm sure you'll find something in the `BarCodeScanner` docs. If you are lucky fixing the proguard setup will resolve your issue. Good luck! (... wouldn't be the first time ;) ) – Trinimon Jun 06 '13 at 16:37
  • @Trinimon Is it mandatory to use proguard for sign an apk ? If i uncomment the proguard line of BarCodeScanner and in my Main project. I just Get a Dalvik Error Code. – gmourier Jun 06 '13 at 17:26
  • No, you can switch it off, though this means your Java code can be easily extracted from the APK package. No issue if you are working on an open source project, but ... ;-) Anyway, this is a good way to test whether proguard might be the root cause for the error. **p.s.** by the way: HTML/CSS3/JS files can be extracted anyway (no obfuscation on the assets folder) – Trinimon Jun 06 '13 at 18:36
  • Ive tried with proguard off, error is still here – gmourier Jun 06 '13 at 20:12
  • Do you mean *Dalvik Error Code 1* or *Proguard returned with error code 1*? The second one shouldn't appear, if you disabled proguard correctly. If you have only (and still) the first one, you know that the error is not connected to proguard. There are many other potential solutions, e.g. http://stackoverflow.com/questions/8538408/android-conversion-to-dalvik-format-failed-with-error-1-and-proguard ... sorry – Trinimon Jun 06 '13 at 20:34
  • 1
    Yes. When i restart Eclipse this morning all works fine. Seriusly... I don't even know why but its working. I've signed my apk. Ps: I disabled proguard. – gmourier Jun 07 '13 at 07:09

1 Answers1

0

Open up the .jar file with WinZip/WinRAR and remove the offending .class files. Re-save the jar, and put the new jar back into your project.

Ken Wolf
  • 23,133
  • 6
  • 63
  • 84
  • I don't know what i need to remove. captureactivity.jar has a lot of .class – gmourier Jun 06 '13 at 16:02
  • No hints from the log? In your console or logcat? – Ken Wolf Jun 06 '13 at 16:13
  • @mourierg What about this? (http://simonmacdonald.blogspot.co.uk/2012/10/barcode-scanner-example-projects.html) "It looks like you are including cordova.jar twice in your build path. You don't need it in your library project libs directory, you only need it in your applications libs folder." – Ken Wolf Jun 06 '13 at 16:17
  • Cordova.jar is only include one time in main folder. It isn't call on the third library. But i have some news from the console when i activate proguard. I edit my post for write the code – gmourier Jun 06 '13 at 16:22