目录

HAP

Harmony Ability Package (HAP) is the basic unit for app installation and running. A HAP is a module package generated by packaging code, resources, third-party libraries, configuration files, and so on. It is mainly classified into two types: entry and feature.

An application package can contain either only one entry HAP or one entry HAP plus one or more feature HAPs.

When to Use

Constraints

Creating a HAP

To create a HAP in DevEco Studio:

  1. Create a project to build the first ArkTS application.

  2. Right-click the project directory and choose New > Module from the shortcut menu.

  3. In the dialog box displayed, select Empty Ability as the template and click Next.

  4. On the module configuration page, set Module name, Module Type, and Device Type, and click Next.

  5. On the ability configuration page, set Ability name and click Finish.

Developing a HAP

Debugging a HAP

After building code into one or more HAPs and installing or updating these HAPs, you can debug them. For details about how to compile the same HAP into different versions based on the deployment environment, target user group, and running environment, see Customizing Multi-Target Builds.

To debug a HAP, use either of the following tools:

Sample Code