Debug Platform Code
Stay organized with collections
Save and categorize content based on your preferences.
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
. Uncheck Native
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
, run adb 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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-01-30 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-30 UTC."],[],[],null,["# Debug Platform Code\n\nAndroid Studio provides a debugger that lets you do the following and more:\n\n1. Select a device to debug your app on.\n2. Set breakpoints in your Java, Kotlin, and C/C++ code.\n3. Examine variables and evaluate expressions at runtime.\n\nApplication Process (Java) Debugging\n------------------------------------\n\n1. Flash your build to a device or emulator.\n\n2. Set breakpoints in your Java or Kotlin code.\n\n3. Click `Run` \\\u003e `Attach Debugger to Android Process`. Uncheck `Native\n Debugger`.\n\n4. Select your device, select the process, and click `Attach`.\n\n5. Hit the breakpoint in your code.\n\nSystem Process (C++) Debugging\n------------------------------\n\n1. Flash your build to a device or emulator.\n\n2. From inside `path/to/repo/checkout`, run `adb root`. Only one emulator\n or device can be running.\n\n3. Set breakpoints in your native code.\n\n4. Click `Run \u003e Attach Debugger to Android Process`.\n\n5. Check `Show system processes`.\n\n6. Select your device, select the process, and click `Attach`.\n\n7. Hit the breakpoint in your code."]]