this post assume that you've installed app that want to be debug.
please use f-droid or other platform instead of pull it directly from your android devices if you encounter error
INSTALL_FAILED_MISSING_SPLIT
the step in general:
- find the android application package name and its path
- pull it to the linux machine
- decompile it
- update android manifest
- rebuild it
- reinstall it
Find the APK name
adb shell pm list packages | grep <your-filter>
adb shell pm path <package-name>
pull it to your linux machine
adb pull <path-base.apk>
decompile it
apktool d ./base.apk -o ./disassembly
update android manifest
locate application
tag and add this attribute:
android:debuggable="true"
optionally, you may also want to rename the package name, edit renameManifestPackage
on apktool.yml
if you want to check the package name after renamed:
aapt dump badging ./mod.apk | grep package
rebuild it
apktool b ./disassembly -o mod.apk
zipalign -p -f -v 4 mod.apk aligned_mod.apk
keytool -genkey -v -keystore debug,keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Lorem, OU=Lorem Department, O=Ipsum Corporation, L=Anytown, ST=CA, C=US"
apksigner sign --ks debug.keystore --ks-pass pass:android --out final_mod.apk aligned_mod.apk
reinstall it
adb install -t ./final_mod.apk
note
you could also use this way to patch apk in general, although some application might have some level of protection to prevent you from patch it.
things to keep in mind when you modify or rename the package name:
- remove line
DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
- adjust attribute of
android:authorities
with new package name
references:
- stackoverflow - pull the apk
- stackoverflow - disable verify apps on adb
- stackoverflow - install test app using adb
- stackoverflow - print package name of apk file
- stackoverflow - what is debuggable?
- github - rename package with apktool
- telegram - linked as context and historical purposes
- youtube - debugging android app
- github - jadx smali debugger
- github - frida plugin for debugging smali
- github - use this module instead of manually modify the android manifest, make your life easier