Skip to content

Instantly share code, notes, and snippets.

@dostiharise
Last active August 29, 2015 14:06
Show Gist options
  • Save dostiharise/1c28f731dcd7f8ae738b to your computer and use it in GitHub Desktop.
Save dostiharise/1c28f731dcd7f8ae738b to your computer and use it in GitHub Desktop.
Android APK recompilation - using apktool
# Search for the apk's location on device
# adb shell pm list packages -f | grep "com.package.target"
# pull the apk from device
$ adb pull /data/app/target.apk ./target.apk
# decompile the apk
$ apktool d target.apk target-unpack-dir
# Make modifications to the APK
### Used gedit or any text editor
# rebuild the apk
$ apktool b target-unpack-dir/ target-recompiled.apk
# zip align
$ zipalign -v 4 target-recompiled.apk target-align.apk
# sign the apk
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /home/user/.android/debug.keystore -storepass android -keypass android ./target-align.apk androiddebugkey
# install the apk to the device.
### Uninstall the current app if it is already installed.
$ adb install ./target-align.apk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment