You need to sign in or sign up before continuing.
multi-hap-release-deployment.md 3.8 KB
Newer Older
E
ester.zhou 已提交
1 2 3 4 5 6 7 8
# Multi-HAP Development, Debugging, Release, and Deployment Process

Below is the process of developing, debugging, releasing, and deploying multiple HAP files.

**Figure 1** Process of developing, debugging, releasing, and deploying multiple HAP files
![hap-release](figures/hap-release.png)

## Development
E
ester.zhou 已提交
9
You can use [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio) to create multiple modules as needed and develop services in respective modules.
E
ester.zhou 已提交
10 11

## Debugging
E
ester.zhou 已提交
12 13 14
After building code into one or more HAP files and installing or updating these HAP files, you can debug them. You can leverage a single set of code and files to build multiple target editions for different audiences, deployment environments, operating environments, and more. For details, see [Customizing Multi-Target and Multi-Product Builds](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/customized-multi-targets-and-products-0000001430013853-V3?catalogVersion=V3).

You can debug HAP files using the methods:
E
ester.zhou 已提交
15 16 17 18
* Using DevEco Studio for debugging

   Follow the instructions in [Debugging Configuration](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-debugging-and-running-0000001263040487#section10491183521520).

E
ester.zhou 已提交
19 20 21 22 23 24 25
* Using [hdc](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) (which can be obtained in the **toolchains** directory of the OpenHarmony SDK) for debugging
   
   Before debugging HAP files, install or update them using either of the methods:

 1. Use hdc to install and update the HAP files.

    When specifying the HAP files, use the paths of the files on the operating system, for example, Windows.
E
ester.zhou 已提交
26 27 28

    ```
    // Installation and update: Multiple file paths can be specified.
E
ester.zhou 已提交
29
    hdc install C:\entry.hap C:\feature.hap
E
ester.zhou 已提交
30 31 32
    // The execution result is as follows:
    install bundle successfully.
    // Uninstall
E
ester.zhou 已提交
33
    hdc uninstall com.example.myapplication
E
ester.zhou 已提交
34 35 36
    // The execution result is as follows:
    uninstall bundle successfully.
    ```
E
ester.zhou 已提交
37 38
 
 2. Run the hdc shell command, and then use the Bundle Manager (bm) tool to install and update the HAP files.
E
ester.zhou 已提交
39

E
ester.zhou 已提交
40 41
    When specifying the HAP files, use the paths of the files on the real device. The sample code is as follows:
    
E
ester.zhou 已提交
42
    ```
E
ester.zhou 已提交
43 44
    // Run the hdc shell command before using the bm tool.
    hdc shell
E
ester.zhou 已提交
45
    // Installation and update: Multiple file paths can be specified.
E
ester.zhou 已提交
46
    bm install -p /data/app/entry.hap /data/app/feature.hap
E
ester.zhou 已提交
47 48 49 50 51 52 53
    // The execution result is as follows:
    install bundle successfully.
    // Uninstall
    bm uninstall -n com.example.myapplication
    // The execution result is as follows:
    uninstall bundle successfully.
    ```
E
ester.zhou 已提交
54
    After the HAP files are installed or updated, you can debug them by following the instructions in [Ability Assistant](../tools/aa-tool.md).
E
ester.zhou 已提交
55

E
ester.zhou 已提交
56 57 58 59
## Release
When your application package meets the release requirements, you can package and build it into an App Pack and release it to the application market on the cloud. The application market verifies the signature of the App Pack. If the signature verification is successful, the application market obtains the HAP files from the App Pack, signs them, and distributes the signed HAP files.

## Deployment
E
ester.zhou 已提交
60
The application market on the cloud distributes the applications to application market clients. These applications can contain one or more HAP files. After the user selects an application to download, the application market downloads all the HAP files contained in this application whose **deliveryWithInstall** field is set to **true**.
E
ester.zhou 已提交
61 62 63

## Installation on a Device
After the download is complete, the application market client calls the installation API of the bundle manager service in the system to install the downloaded HAP files. The bundle manager service deploys HAP files by application in the specified directory to complete the application installation.