Skip to content

Instantly share code, notes, and snippets.

@wzpan
Created June 12, 2017 03:48
Show Gist options
  • Save wzpan/3f62eb9e43c857a40fc9e22a56dcf579 to your computer and use it in GitHub Desktop.
Save wzpan/3f62eb9e43c857a40fc9e22a56dcf579 to your computer and use it in GitHub Desktop.
Sign an android app.
# sh sign.sh path_to_apk.apk path_to_key_store.keystore STOREPASSWORD STOREALIAS
rm -rf build
mkdir build
cd build
unzip $1
rm -rf META-INF
APK_NAME=`basename $1`
STORE_PATH=$3
STORE_PASS=$3
STORE_ALIAS=$4
zip -r ${APK_NAME} *
jarsigner -sigalg MD5withRSA -digestalg SHA1 -storepass ${STORE_PASS} -keystore ${STORE_PATH} -signedjar signed.apk $APK_NAME ${STORE_ALIAS}
zipalign -v 4 signed.apk release.apk
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment