JenkinsCI : zipalign failed on APK : exit code 1

1.4k Views Asked by At

I am using Jenkins for building my android project. We use Android Signing Plugin to sign apks. Recently on one branch it is failing with the following error log:

[SignApksBuilder] /var/lib/jenkins/android-sdk/build-tools/29.0.2/zipalign -f -p 4 /var/lib/jenkins/workspace/Android/app/build/outputs/apk/production/release/app_productionRelease_0.11.1_HEAD_3048d80.apk /var/lib/jenkins/workspace/Android/SignApksBuilder-out/zipalign/aligned-app_productionRelease_0.11.1_HEAD_3048d80-1628945884194489230.apk
[Android] $ /var/lib/jenkins/android-sdk/build-tools/29.0.2/zipalign -f -p 4 /var/lib/jenkins/workspace/Android/app/build/outputs/apk/production/release/app_productionRelease_0.11.1_HEAD_3048d80.apk /var/lib/jenkins/workspace/Android/SignApksBuilder-out/zipalign/aligned-app_productionRelease_0.11.1_HEAD_3048d80-1628945884194489230.apk
FATAL: [SignApksBuilder] zipalign failed: exit code 1
ERROR: zipalign failed on APK /var/lib/jenkins/workspace/Android/app/build/outputs/apk/production/release/app_productionRelease_0.11.1_HEAD_3048d80.apk: exit code 1

This is a release build and the only meaningful changes on this branch is

  • update android gradle plugin from 4.0.2 to 4.1.0
  • update gradle from 6.1.1 to 6.5

Can anyone shed some light on what is going wrong?

PS: I tried to post issue to Jenkins Jira as the plugin readme says but seems like the Log in feature is broken :/

Thanks!

3

There are 3 best solutions below

9
Ivor On

after fighting with this weird issue I downgrade from 4.1.0 to 4.0.2. This solve the issue looks like zipalign plugin in Jenkins hasn't been updated in 3 years, maybe this will be solve with next update of the zipAlignPlugin in Jenkins.

0
Arka Prava Basu On

If I understand correctly running zipalign is not necessary atleast on the latest AGP as mentioned on this issue thread It can be used to verify if the output release apk is aligned properly.

zipalign -c -v 4 signed.apk
0
Ivor On

My solution is to use zipalign on gradle project options, works well, but I haven't tried anymore the plugin In Jenkins that contains the zipalign for signing apks.