Created
May 18, 2022 05:19
-
-
Save DaniAsh551/97ff362a7716c83bc3e5016c97c3521f to your computer and use it in GitHub Desktop.
Generate a signed apk from decompiled smali sources (with a tool like apktool)
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
#!/bin/sh | |
BUILD_TOOLS=$HOME/Android/Sdk/build-tools/32.1.0-rc1 | |
PATH="$PATH:$BUILD_TOOLS" | |
KEY="$PWD/key.jks" | |
if [ ! -f $KEY ]; then | |
echo "No keystore found in Working Directory. Creating a new one. Please fill the prompts, or cancel and copy your keystore file to $KEY." | |
keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias apk | |
fi | |
##clean | |
echo Cleaning... | |
rm -rf dist/* | |
##repack | |
echo Repacking... | |
apktool b . | |
APK=$(ls -1 dist | head -n 1) | |
echo Aligning... | |
zipalign 4 -f ./dist/$APK ./dist/out-$APK | |
echo Signing... | |
apksigner sign --ks key.jks ./dist/out-$APK | |
echo Done: out-$APK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment