Created
April 10, 2014 07:30
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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
This is a really useful little script for automating the release process. I like that it handles signing, verification, and zipalign in sequence instead of having to run each command manually. The main thing I’d keep in mind is that newer Android/Play Store workflows may use Gradle and AABs rather than this older APK-based approach, but the script is still a good example of how the signing process can be automated.