How to fix this ZipException when compiling a Jenkins Android project?

I recently upgraded the Android SDK on a Jenkins machine to rev15 with rev13 and I had to redo some of our custom build materials in build.xml to fit into the changes made to rev14. I worked it out on my workstation and tested it, expecting it to be peachy. Instead, the build fails with the following error:

 -obfuscate: -dex: [dex] Converting compiled files and external libraries into /export/home/hudson/jobs/path/to/the/file/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:127) [dx] at java.util.zip.ZipFile.<init>(ZipFile.java:143) [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 /opt/android-sdk-linux/tools/ant/build.xml:729: The following error occurred while executing this line: /opt/android-sdk-linux/tools/ant/build.xml:731: The following error occurred while executing this line: /opt/android-sdk-linux/tools/ant/build.xml:743: The following error occurred while executing this line: /opt/android-sdk-linux/tools/ant/build.xml:249: null returned: 1 

I can successfully create a project by running ant as a Jenkins user directly in the Jenkins workspace directory with the same Android SDK, Ant and JDK that Jenkins uses. I even cut and paste the execution line from the Jenkins log to make sure all buttons and switches are set the same. So this is about how Jenkins starts building that problem.

I had Jenkins, which resets the environment as the shell exec step of the assembly, and I see that the LD_LIBRARY_PATH variable is set.

 LD_LIBRARY_PATH=/u0/jdk1.6.0_29/jre/lib/i386/server:/u0/jdk1.6.0_29/jre/lib/i386:/u0/jdk1.6.0_29/jre/../lib/i386 

I set this value in my terminal when starting the assembly from the shell, and it fails the same way as when Jenkins works. Ah ha!

The problem is that I cannot figure out how to save the LD_LIBRARY_PATH variable from installation, or point out what will not cause this problem. It is not installed in the Jenkins user environment, and I cannot find anything that could be a reference to it in the Jenkins configuration. The value it set changed when I installed the updated JDK and updated the JAVA value in /etc/defaults/jenkins , so it is clearly related, but unfortunately the behavior has not improved.

I have no ideas. Any help?

+7
source share
2 answers

The problem was that, due to some chicanery configuration related to using the Jenkins matrix-building function (by the way, a very nice function), the library did not put its classes.jar file where the parent project was expecting to find it, causing an error message. It was basically a β€œfile not found” that did not say so. We are still not sure that (if what?), LD_LIBRARY_PATH was relevant.

My colleague changed the build.xml file for the main project and the library to more strongly agree on where the output files will end up, and now everything works again, to our relief.

+1
source

I had the same problem. I was building on Jenkins, and the box was not copied correctly to the libraries.

I am using the Jenkins Copy Artifacts Plugin to grab a shared library jar and copy it to libs /. I got an error when I didn't use the "Flatten Directories" option. As soon as I just had a jar in the libs directory, everything was fine.

Hope this saves someone a headache!

0
source

All Articles