• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Converting HSP to HAR
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9The HSP has requirements on the consistency of bundle names and signatures. Installing an HSP file in the debugging phase may cause many integration issues during multi-module development. In this case, you are advised to use the HAR file instead. This topic describes how to convert an HSP project to an HAR project by changing the configuration items.
10## How to Convert
11
121. In the **module.json5** file of the HSP module, change the value of the **type** field to **har** and delete the **deliveryWithInstall** and **pages** fields.
13    ```json
14    // MyApplication\library\src\main\module.json5
15    {
16        "module": {
17            "name": "har",
18            "type": "har",
19            "deviceTypes": [
20            "default",
21            "tablet",
22            "2in1"
23            ]
24        }
25    }
26    ```
272. Delete the **main_pages.json** file from the **resource\base\profile** folder.
28
293. Replace the content in the **hvigorfile.ts** file of the HSP module with the following:
30    ```ts
31    // MyApplication\library\hvigorfile.ts
32    import { harTasks } from '@ohos/hvigor-ohos-plugin';
33
34    export default {
35        system: harTasks,  /* Built-in plugin of Hvigor. It cannot be modified. */
36        plugins:[]         /* Custom plugin to extend the functionality of Hvigor. */
37    }
38    ```
39
404. Delete the **packageType** configuration from the **oh-package.json5** file.
41
425. Delete **targets** from the HSP configuration of the **modules** module in the project-level **build-profile.json5** configuration file.
43