APKs
How to reverse engineering an APK, edit the code and recompile the APK?
- Decompile the apk:
apktool d application.apk - Use MobSF or jadx-gui to analyze the source code.
- Edit the desired part of the smali code extracted in step 1.
- Rebuild the modified apk:
apktool b -f -d application - Move the apk:
mv application/dist/application.apk application-edited.apk - Generate a key (you will prompted to choose a password, remember it):
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 - Sign the apk:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore application-edited.apk alias_name - Verify the apk:
jarsigner -verify -verbose -certs application-edited.apk - Zipalign the apk for optimal loading:
zipalign -v 4 application-edited.apk application-edited-aligned.apk
References: Decompile and recompile android APK, apktool documentation and BEGINNER’S GUIDE TO SMALI CODING