Android App Debugging¶
JEB supports debugging Dalvik code via JDWP and Native *.so libraries via gdb/lldb. A single JEB session allows seamless transition between debugging the Dalvik VM, jumping into native methods invoked via JNI, debugging native code (arm, x86, else), and switching back to Dalvik.
First, make sure to read the Generic debugging page.
- Tutorial, intro: An introduction to JEB Android Debuggers
- Tutorial, intermediate: Advanced Debugger Usage via the Interpreter
- A note on recent Android versions: Debugging Android apps on Android Pie and above
- API/Scripting: Crypto Monitoring with the Android Debuggers API
- Use-case, obfuscation: Defeating AppSolid Android application protector
- Use-case, dynamic dex: Debugging Dynamically Loaded DEX Bytecode Files
- JNI debugging helper: Dynamic JNI Detection Plugin
(Reference: List to all blog articles on debugging)
Generating Debuggable APK¶
While JEB does its best to support debugging non-debuggable apps (eg, on emulators or rooted devices, with caveats), it is generally easier to debug Android applications explicitly marked debuggable in their Manifest: <application android:debuggable="true" ...>
JEB has built-in utility to rebuild a non-debuggable APK into a debuggable one, while maintaining the entire structure of the application intact, except for its signing data of course. Navigate to your JEB folder, and use the start-up script to run: (in the example below, on Windows)
$ jeb_wincon.bat -c --makeapkdebug -- file.apk
Upon success, file_debuggable.apk will be generated. Sign it using Android SDK's
apksigner, install it on your device, and start debugging.
Keep in mind that this solution has shortcomings: Anti-debugging code may check at runtime that the app is not debuggable, as would be expected. More elaborate protections may implement certificate pinning-style checks, where the code verifies that it is signed using a specific certificate.
Section under construction.