RuntimeException signing Android jar files



I’m trying to sign my built jar file for distribution on Android. However, every time the server calls the jarsigner with my keystore file, it outputs the following error:

jarsigner error: java.lang.RuntimeException: keystore load: Invalid keystore format

Using the jarsigner on my local environment works nicely, but not on CircleCI.

The signing shell script:
unsignedAPK="${apkDir}/android-release-unsigned.apk" jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $unsignedAPK myKey.keystore myAlias -storepass $ANDROID_KEY_PASS $ANDROID_HOME/build-tools/23.0.1/zipalign -v 4 $unsignedAPK $CIRCLE_ARTIFACTS/android-release.apk


How are you getting your key store into the CircleCI build? Are you checking it into Git?


Yes. The key store is in my Git repository.


Is the order of the parameters right here? The intuition tells me that you are passing an APK as a keystore. Could that be true?


Thanks! I didn’t notice that mistake. Works now :smile: