I have a project that builds ok in Eclipse but throws a ZipException when executing "ant debug". The output is the following (paths and project name excluded)
-dex:
[dex] Converting compiled files and external libraries into /home/.../Android/[folder]/bin/classes.dex...
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] java.util.zip.ZipException: error in opening zip file
[dx] at java.util.zip.ZipFile.open(Native Method)
[dx] at java.util.zip.ZipFile.<init>(ZipFile.java:131)
[dx] at java.util.zip.ZipFile.<init>(ZipFile.java:148)
[dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:206)
[dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[dx] at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:206)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:174)
[dx] at com.android.dx.command.Main.main(Main.java:95)
[dx] 1 error; aborting
BUILD FAILED
/home/.../android-sdk-linux_x86/tools/ant/build.xml:818: The following error occurred while executing this line:
/home/.../android-sdk-linux_x86/tools/ant/build.xml:820: The following error occurred while executing this line:
/home/.../android-sdk-linux_x86/tools/ant/build.xml:832: The following error occurred while executing this line:
/home/.../android-sdk-linux_x86/tools/ant/build.xml:278: null returned: 1
This project references a library project which references another library project. So
Project A -> Project B -> Project C
To me, the weird part is that installing from eclipse everything works perfectly, but I need to be able to build the project from Ant.
I've googled for answers without success. Similar questions in SO that didn't help
How do I fix this ZipException while compiling an Android project on Jenkins?
Configuring ant to run unit tests. Where should libraries be? How should classpath be configured? avoiding ZipException
I was getting this same error while dexing. I found that a corrupted .jar
file in an included android library project was causing this issue.
Fixing the corrupted .jar
file in the included android library project fixed the issue.
Hope this helps someone! =D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With