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 $?