Whether an app supports debugging is determined based on the debug field in the app.json5 file and the debuggable field in the build-profile.json5 file. The app.json5 file takes precedence over the build-profile.json5 file.
Choose Run > Edit Configurations > Debugger. On the left pane, choose Application > target module. On the right pane, set Debug type.

Debug Type | Code Type |
|---|---|
Detect Automatically | ArkTS/JS. The debugger is selected based on the programming languages involved in the project module and its dependent modules. |
ArkTS/JS |
|
Native | C/C++ |
Dual (ArkTS/JS + Native) | ArkTS/JS and C/C++ for C/C++ projects |
You can use either of the following modes as required:
Since DevEco Studio 4.1 Canary2, the app/atomic service package is not pushed for installation if the code does not change. That is, only the changed modules and the modules that rely on the changed modules are pushed and installed on the device. For example, the entry module relies on the HSP module. If the code of the HSP module changes, the HSP and entry modules will be pushed and installed during debugging.
To set the HAP installation mode:
Choose Run > Edit Configurations, and select or deselect Keep Application Data under Installation Options. Selecting Keep Application Data will install the app/atomic service in overwrite mode, which retains the app/atomic service cached data.

If you do not set debugging parameters, the app/atomic service will be installed and run based on the default configuration. You can set the parameters under Installation Options and Launch Options to match your case.



You can add a UIAbility or an ExtensionAbility to the project. For details, see UIAbility Component or ExtensionAbility Component.

By configuring environment variables under Environment Variables, you can configure and manage the app development environment, as well as control the app behavior.

Click
to add a configuration item. The following configuration items are supported:
After the environment variables are configured, Keep Application Data does not take effect.
Select the set environment variables, and then click Apply for them to take effect.

If your app contains a WebView component page to be debugged, use DevTools of the browser. For details, see Debugging Frontend Pages by Using DevTools. Debugging the WebView component requires complex command line operations such as port forwarding. You can select Auto WebView Debug in DevEco Studio, which automatically listens for the WebView process that can be debugged and completes port forwarding within two minutes after the app is started.
This feature is supported since DevEco Studio 5.0.5 Release.
To enable the feature:
Choose Run > Edit Configurations. On the General tab page, select Auto WebView Debug.

After this feature is enabled, when a WebView component process that can be debugged is detected on the device, the port that is successfully forwarded is displayed on the Run panel. You can connect to the port for debugging using DevTools of the browser.

If a device in a project has multiple modules (for example, a device has entry and feature modules) and the modules are invoked by each other, you need to install the HAPs of the modules on the device in the debugging phase. In this case, you need to specify the modules on the Deploy Multi Hap/Hsp tab page. When you start debugging, DevEco Studio will install the specified modules on the device.
To install multiple modules for debugging:
Choose Run > Edit Configurations. On the Deploy Multi Hap/Hsp tab page, select Deploy Multi Hap/Hsp Packages and specify the modules.

If a module has direct and indirect dependency modules (for example, the entry module depends on the HAR module, which in turn depends on the HSP module), you need to install HAPs of all these modules in the debugging phase. In this case, you can select Auto Dependencies. When you start debugging, DevEco Studio will install all dependency modules on the device.
To deploy dependencies:
Choose Run > Edit Configurations. On the General tab page, select Auto Dependencies.

In the Before launch pane, click
to add a task before the app is started.

To remove a task, click
.

After selecting Auto Dependencies, you can also select Deploy Multi Hap/Hsp Packages to push all packages.
DevEco Studio 6.0.2 Beta1 and later versions allow your app to run on multiple devices, including real devices and launched emulators.


