OpenHarmony Flutter Native Code Breakpoint Debugging Guide
I. Prerequisites
- DevEco Studio installed
- A Flutter OH application project created
II. Debugging the ohos Platform Code of the Project
1. Open the ohos Directory of the Flutter Project
-
Use DevEco Studio to open the ohos directory of the Flutter project

-
Open the file you want to debug

2. Set Breakpoints
-
Click to the left of the line number; a red dot indicates a breakpoint

-
You can set breakpoints at key locations such as function entries, variable assignments, and event callbacks
3. Start Debugging
-
Select a real device or an emulator as the run target

-
Click the Debug button (the green bug icon) on the toolbar

-
The project is automatically compiled and deployed; the program pauses automatically when it hits a breakpoint

III. Debugging the Flutter ohos Platform Cache Code
1. Debugging the Flutter SDK ohos Adaptation Layer Cache Code
-
Open the Flutter SDK ohos adaptation layer cache path
Path:
project\ohos\oh_modules\.ohpm\@ohos+flutter_ohos\oh_modules\@ohos\flutter_ohos

- Open the SDK cache file you want to debug, then follow step 2 above to debug
2. Debugging the Third-Party Library Cache Code Used by the Flutter OH Application
-
The ohos adaptation layer cache code of third-party libraries is located under
project\ohos\oh_modules\.ohpm\
-
Open the third-party library code you want to debug, then follow step 2 above to debug
IV. Common Issues and Solutions
-
Breakpoints not hit
- Check whether it is a debug build
- Confirm that the breakpoint is set on the actual execution path
-
Cannot step into ArkTS code
- Check whether the ArkTS files are correctly compiled and deployed
-
Debugging lags or crashes
- Debugging on a real device is recommended; emulator performance is limited