Jenkins failed to sign Android APK, but works from the command line

I have the following build environment:

  • Ubuntu
  • Java 1.6.0_24
  • Apache ant 1.8.2
  • Jenkins 1.427
  • Berth 6.1.26

I can create the release APK (zipaligned and signed) from the command line (in the jenkins workspace area) by running ant release , and then, after typing a hint, enter into the keystore.

However, using the same build command from the Jenkins job, it fails with the following:

 release: [echo] Signing final apk... [signjar] Signing JAR: /home/james/.jenkins/workspace/android-sam/androidsam/bin/AndroidSam-unsigned.apk to /home/james/.jenkins/workspace/android-sam/androidsam/bin/AndroidSam-unaligned.apk as mykeystore [signjar] jarsigner: Certificate chain not found for: mykeystore . mykeystore must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain. BUILD FAILED /home/james/tools/android-sdk-linux_x86/tools/ant/main_rules.xml:641: jarsigner returned: 1 

In the jenkins ant target step, I set the following properties:

 key.store=my-release-key.keystore key.alias=mykeystore key.store.password=<mypass> key.alias.password=<mypass> sdk.dir=/home/james/tools/android-sdk-linux_x86 

What could cause jenkins to not sign, causing the same goal from the command line to stop running?

I searched this for a search and found that some people write their own bash scripts to sign their APKs and then run them as shells, but that seems pretty dirty ... any suggestions?

thanks

+4
source share
1 answer

We created our Jenkins server to sign our APKs using the same technique as here, and it works for us. One difference is that I put the fully qualified path in the keystore, rather than relying on the relative path. I never know where they are relatives. If your keystore is in version control, Jenkins provides a workspace root space environment variable that you can use to point to it.

It would also be advisable to test this assembly from the command line, where you define all of these properties using the ant -Dkey.store=/some/key.store ... to make sure that all the values ​​you provide are correct.

+3
source

All Articles