Debug platform code
Stay organized with collections
Save and categorize content based on your preferences.
Android Studio for Platform (ASfP) provides a powerful debugger that lets you:
- Select a device to debug on.
- Set breakpoints in your Java, Kotlin, and C/C++ code.
- Examine variables and evaluate expressions at runtime.
Before you use the debugger, you must flash your build to a device or emulator.
App process (Java/Kotlin) debugging
To debug a Java or Kotlin application process:
Set breakpoints in your Java or Kotlin code within ASfP.
Select Run > Attach Debugger to Android Process from the menu.
In the Choose Process dialog, make sure the Debug type is set to
Java Only.
Select your device from the list.
Choose the specific application process you want to debug.
Click OK.
Interact with the application on your device to hit the breakpoints.
System process (C/C++) debugging
To debug a system process written in C or C++:
Verify that you have only one device or emulator running.
Open a terminal and run adb root
from your AOSP checkout root: bash
adb root
Set breakpoints in your C/C++ code within ASfP.
Select Run > Attach Debugger to Android Process from the menu.
In the Choose Process dialog, change the Debug type to Native
Only or Dual (Java + Native).
Check the Show all processes box to see system processes.
Select your device from the list.
Choose the specific system process you want to debug (such as
surfaceflinger
or system_server
).
Click OK.
The debugger attaches to the process. Interact with the device to hit your
breakpoints.
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-09-04 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-09-04 UTC."],[],[],null,["Android Studio for Platform (ASfP) provides a powerful debugger that lets you:\n\n- Select a device to debug on.\n- Set breakpoints in your Java, Kotlin, and C/C++ code.\n- Examine variables and evaluate expressions at runtime.\n\nBefore you use the debugger, you must flash your build to a device or emulator.\n\nApp process (Java/Kotlin) debugging\n\nTo debug a Java or Kotlin application process:\n\n1. Set breakpoints in your Java or Kotlin code within ASfP.\n\n2. Select **Run \\\u003e Attach Debugger to Android Process** from the menu.\n\n3. In the **Choose Process** dialog, make sure the **Debug type** is set to\n **Java Only**.\n\n4. Select your device from the list.\n\n5. Choose the specific application process you want to debug.\n\n6. Click **OK**.\n\n7. Interact with the application on your device to hit the breakpoints.\n\nSystem process (C/C++) debugging\n\nTo debug a system process written in C or C++:\n\n1. Verify that you have only one device or emulator running.\n\n2. Open a terminal and run `adb root` from your AOSP checkout root: `bash\n adb root`\n\n\u003c!-- --\u003e\n\n1. Set breakpoints in your C/C++ code within ASfP.\n\n2. Select **Run \\\u003e Attach Debugger to Android Process** from the menu.\n\n3. In the **Choose Process** dialog, change the **Debug type** to **Native\n Only** or **Dual (Java + Native)**.\n\n4. Check the **Show all processes** box to see system processes.\n\n5. Select your device from the list.\n\n6. Choose the specific system process you want to debug (such as\n `surfaceflinger` or `system_server`).\n\n7. Click **OK**.\n\n8. The debugger attaches to the process. Interact with the device to hit your\n breakpoints."]]