Android Studio provides a debugger that lets you do the following and more:
- Select a device to debug your app on.
- Set breakpoints in your Java, Kotlin, and C/C++ code.
- Examine variables and evaluate expressions at runtime.
Application Process (Java) Debugging
Flash your build to a device or emulator.
Set breakpoints in your Java or Kotlin code.
Click
Run
>Attach Debugger to Android Process
. UncheckNative Debugger
.Select your device, select the process, and click
Attach
.Hit the breakpoint in your code.
System Process (C++) Debugging
Flash your build to a device or emulator.
From inside
path/to/repo/checkout
, runadb root
. Only one emulator or device can be running.Set breakpoints in your native code.
Click
Run > Attach Debugger to Android Process
.Check
Show system processes
.Select your device, select the process, and click
Attach
.Hit the breakpoint in your code.