Skip to content

Instantly share code, notes, and snippets.

@martinth
Created April 10, 2014 07:30
Show Gist options
  • Save martinth/10351747 to your computer and use it in GitHub Desktop.
Save martinth/10351747 to your computer and use it in GitHub Desktop.
A simple script to automate signing and aligning of APK files for upload to the Playstore
#!/bin/sh
FOLDER=android/bin
IN_APK_NAME=App-release-unsigned.apk
OUT_APK_NAME=App-release-signed-aligned.apk
KEYSTORE=release-key.keystore
KEYSTORE_ALIAS=app_release
echo ">>> Signing $OUT_APK_NAME..."
jarsigner -verbose -keystore $KEYSTORE "$FOLDER/$IN_APK_NAME" $KEYSTORE_ALIAS || exit $?
echo ">>> Checking if $IN_APK_NAME is verified..."
jarsigner -verify "$FOLDER/$IN_APK_NAME" || exit $?
echo ">>> Running zipalign to create $OUT_APK_NAME..."
zipalign -f 4 "$FOLDER/$IN_APK_NAME" "$FOLDER/$OUT_APK_NAME" || exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment