zipalign 正在手动工作,但在 Jenkins 后期构建下失败。我在 Ubuntu Aws ec2 实例上运行它。请有人可以帮我解决这个问题。
詹金斯输出:
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
我在命令提示符下运行它时的输出:
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
我进一步调查发现还创建了aligned-android-debug-6100835664895780913.apk:
$ 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
那么错误是什么?如何找到它并排除故障?
FATAL: [SignApksBuilder] zipalign failed: exit code 1