Skip to content

How to: JNI debugging

Marco Jansen edited this page Oct 12, 2015 · 1 revision

How to debug your native code in Android


  • Debugging currently only works on rooted devices. Make sure your phone or emulator is rooted and is root when you enter adb. Check this by adb'ing into your device and it should look something like root@<phone_name>:/ #
  • Debugging doesn't work on API 16

  1. Add android:debuggable="true" to the <application> tag in AndroidManifest.xml
  2. Add APP_OPTIM := debug to Application.mk
  3. Open a terminal and cd $PROJECT_DIR/src/main
  4. Make sure you have ndk-gdb in your PATH. ndk-gdb is located in $SDK_DIR/ndk-bundle
  5. ndk-gdb
  6. If you want to debug a bundle, add the <bundle_name>.so to $PROJECT_DIR/src/main/obj/local/$CPU_ABI