zipalign is working manually but failing under Jenkins post build. I am running it on Ubuntu Aws ec2 instance. Please can someone help me in figuring out the issue.
Jenkins Output :
BUILD SUCCESSFUL
Total time: 14.421 secs
Built the following apk(s):
/var/lib/jenkins/workspace/PP_androidBuild/PatientPortal/platforms/android/build/outputs/apk/android-debug.apk
[PP_androidBuild] $ echo '"resolving effective environment"'
[SignApksBuilder] searching environment variable ANDROID_HOME=/opt/android-sdk-linux for zipalign...
[SignApksBuilder] found zipalign in Android SDK's latest build tools: /opt/android-sdk-linux/build-tools/23.0.1/zipalign
[SignApksBuilder] /opt/android-sdk-linux/build-tools/23.0.1/zipalign -f -p 4 /var/lib/jenkins/workspace/PP_androidBuild/PatientPortal/platforms/android/build/outputs/apk/android-debug.apk /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk
[PP_androidBuild] $ /opt/android-sdk-linux/build-tools/23.0.1/zipalign -f -p 4 /var/lib/jenkins/workspace/PP_androidBuild/PatientPortal/platforms/android/build/outputs/apk/android-debug.apk /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk
FATAL: [SignApksBuilder] zipalign failed: exit code 1
ERROR: zipalign failed on APK /var/lib/jenkins/workspace/PP_androidBuild/PatientPortal/platforms/android/build/outputs/apk/android-debug.apk: exit code 1
Finished: FAILURE
Output when I ran it in command prompt :
jenkins@ip-172-31-22-20:~$ /opt/android-sdk-linux/build-tools/23.0.1/zipalign -f -p 4 /var/lib/jenkins/workspace/PP_androidBuild/PatientPortal/platforms/android/build/outputs/apk/android-debug.apk /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk
jenkins@ip-172-31-22-20:~$ ls -lthr /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk
-rw-r--r-- 1 jenkins jenkins 5.9M Sep 8 14:09 /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk
I further investigated and found that aligned-android-debug-6100835664895780913.apk is also created :
$ ls -lthr /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk | grep aligned-android-debug-6100835664895780913.apk
-rwxrwxrwx 1 jenkins jenkins 5.9M Sep 8 14:09 /var/lib/jenkins/workspace/PP_androidBuild/SignApksBuilder-out/zipalign/aligned-android-debug-6100835664895780913.apk
So what is the error ? How to find it and troubleshoot it ?
FATAL: [SignApksBuilder] zipalign failed: exit code 1
PROBLEM
SOLUTION