Skip to content

Instantly share code, notes, and snippets.

@sushruth
Forked from PuKoren/recompile-and-run.sh
Last active June 1, 2017 14:23
Show Gist options
  • Save sushruth/91d6ef9c68fa22897d46e52eb1761f3b to your computer and use it in GitHub Desktop.
Save sushruth/91d6ef9c68fa22897d46e52eb1761f3b to your computer and use it in GitHub Desktop.
Recompile APK + Sign with apktool - Windows version
echo off
:: This is the project folder
set PROJ=%1
shift
:: You must first install apktool (https://github.com/iBotPeaches/Apktool) and android SDK
:: You must also have APKTOOL_HOME, JAVA_HOME/tools and ANDROID_SDK_HOME/build-tools in your PATH (change location as needed)
:: and decompile apk using it
:: apktool d -rf my-app.apk
:: then generate a key for sign in:
:: keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
del signed-app.apk
apktool b -f %PROJ%
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore %PROJ%/dist/%PROJ%.apk alias_name
zipalign -v 4 %PROJ%/dist/%PROJ%.apk signed-app.apk
adb install -r signed-app.apk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment