Jenkins使用签名和对齐为Xamarin.Android项目构建

时间:2014-07-08 21:05:05

标签: android jenkins continuous-integration xamarin xamarin.android

我正在尝试使用Jenkins使用this guide构建Xamarin.Android应用。 除了APK的签名和对齐之外,一切都很好。

KEYSTORE_FILE = $WORKSPACE/Solutions Items/helloworld.keystore
KEYSTORE_ALIAS = helloworld 
INPUT_APK = $WORKSPACE/helloworld.Android/bin/Release/helloworld.android.apk
SIGNED_APK = $WORKSPACE/helloworld.Android/bin/Release/helloworld.android-Signed.apk
FINAL_APK = $WORKSPACE/helloworld.android-Aligned.apk
STORE_PASS = mystrong_pass

我可以使用"将STORE_PASS作为密码输入到构建中作为环境变量"但是这个话题还有另一件事。注入env后,我添加了jarsigner:

jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $KEYSTORE_FILE -storepass $STORE_PASS -signedjar $SIGNED_APK $INPUT_APK $KEYSTORE_ALIAS 
zipalign -f -v 4 $SIGNED_APK $FINAL_APK

之后我开始构建并最终得到以下错误:     输入密钥库的密码短语:jarsigner:您必须输入密钥密码

但提供了密码,如上所示

Build succeeded.
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties content 
KEYSTORE_FILE=$WORKSPACE/Solutions Items/helloworld.keystore
KEYSTORE_ALIAS=helloworld
INPUT_APK=$WORKSPACE/helloworld.Android/bin/Release/helloworld.android.apk
SIGNED_APK=$WORKSPACE/helloworld.Android/bin/Release/helloworld.android-Signed.apk
FINAL_APK=$WORKSPACE/helloworld.android-Aligned.apk
STORE_PASS=mystrong_pass

[EnvInject] - Variables injected successfully.
[Xamarin Test Build] $ /bin/sh -xe /var/folders/vy/ty4s4j.......ygm0000gy/T/hudson18473.......171797.sh
+ jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore /Users/user/.jenkins/workspace/Xamarin Test Build/Solutions Items/helloworld.keystore -storepass mystrong_pass -signedjar /Users/a.strakh/.jenkins/workspace/Xamarin Test Build/helloworld.Android/bin/Release/helloworld.android-Signed.apk /Users/a.strakh/.jenkins/workspace/Xamarin Test Build/helloworld.Android/bin/Release/helloworld.android.apk helloworld
Enter Passphrase for keystore: jarsigner: you must enter key password
Build step 'Execute shell' marked build as failure
Skipped archiving because build is not successful
Finished: FAILURE

请告知

1 个答案:

答案 0 :(得分:0)

您的商店密码是否包含特殊字符?你需要逃避这些。而不是

-storepass $STORE_PASS

-storepass "${STORE_PASS}"

如果这样做无助于将商店密码更改为仅使用字母数字(无特殊字符)的内容。不需要在命令行上转义字母数字。