Created
February 8, 2017 08:22
-
-
Save ddm/959d24b897d71946165b29995e053a54 to your computer and use it in GitHub Desktop.
Unpack or pack an apk
This file contains 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
#!/usr/bin/env bash | |
DIR=`dirname $0` | |
TARGET_APK="target.apk" | |
TARGET_DIR="target" | |
if [[ ! "$1" =~ ^(unpack|pack)$ ]]; then | |
echo "Choose 'unpack' or 'pack'" | |
exit 1 | |
fi | |
if [[ $1 == "unpack" ]]; then | |
rm -rf $DIR/$TARGET_DIR | |
apktool d $DIR/$TARGET_APK | |
elif [[ $ENV == "pack" ]]; then | |
apktool b $DIR/$TARGET_DIR | |
keytool -genkey -v -keystore $DIR/$TARGET_DIR/temporary.keystore -alias temporary -keyalg RSA -keysize 2048 -validity 20000 | |
jarsigner -keystore $DIR/temporary.keystore -verbose $DIR/result.apk temporary | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment