Android APK cannot be signed from Jenkins, but it can work from the command line

I have the following build environments:

> Ubuntu > Java 1.6.0_ 24 > Apache ant 1.8.2 > Jenkins 1.427 > wharf 6.1.26

I can create a release APK (zippaligned and signed) from the command line (in the Jenkins workspace), run ant release, and then type the keystore when prompted

However, if you use the same build command in the Jenkins job, it fails and displays 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 causes Jenkins to fail to sign and execute the same target from the command line?

I've searched this and found that some people are writing their own bash scripts to sign their apks and then run them as shell targets, but this seems to be a dirty way... Any suggestions?

thank you

resolvent:

We have set up our Jenkins server and use the same technology you outlined here to sign our APK. It applies to us. One difference is that I put fully qualified paths into the keystore instead of relying on relative paths. I don't know where they are relative. If your keystore is under version control, Jenkins provides a workspace root environment variable, You can use it to point to it

It's also worth testing this build from the command line. You can define all these attributes using the ant - dkey. Store = / some / key. Store... Instruction to ensure that all the values you provide are correct

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>