RuntimeException signing Android jar files

android

#1

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


#2

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


#3

Yes. The key store is in my Git repository.


#4

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?


#5

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


#6