Debug Platform Code

Android Studio provides a debugger that lets you do the following and more:

  1. Select a device to debug your app on.
  2. Set breakpoints in your Java, Kotlin, and C/C++ code.
  3. Examine variables and evaluate expressions at runtime.

Application Process (Java) Debugging

  1. Flash your build to a device or emulator.

  2. Set breakpoints in your Java or Kotlin code.

  3. Click Run > Attach Debugger to Android Process. Uncheck Native Debugger.

  4. Select your device, select the process, and click Attach.

  5. Hit the breakpoint in your code.

System Process (C++) Debugging

  1. Flash your build to a device or emulator.

  2. From inside path/to/repo/checkout, run adb root. Only one emulator or device can be running.

  3. Set breakpoints in your native code.

  4. Click Run > Attach Debugger to Android Process.

  5. Check Show system processes.

  6. Select your device, select the process, and click Attach.

  7. Hit the breakpoint in your code.