• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Bundle Manager
2
3
4The Bundle Manager enables you to install, uninstall, update, and query a bundle (application). It provides the bundle debugging capabilities, for example, installing and uninstalling a bundle and querying bundle information.
5
6> **NOTE**
7>
8> Before using this tool, you must obtain the [hdc tool](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) and run the hdc shell command.
9
10
11**Table 1** bm commands
12
13| Name| Description|
14| -------- | -------- |
15| help | Displays the commands supported by the Bundle Manager tool.|
16| install | Installs a bundle.|
17| uninstall | Uninstalls a bundle.|
18| dump | Displays bundle information.|
19| clean | Clears the cache and data of a bundle.|
20| enable | Enables a bundle. A bundle can be used after being enabled.|
21| disable | Disables a bundle. A bundle cannot be used after being disabled.|
22| get | Obtains the UDID of a device.|
23| quickfix | Performs patch-related operations, such as installing or querying a patch.|
24
25
26## Help Command
27
28**Table 2** Help command
29
30| Name| Description|
31| -------- | -------- |
32| bm help | Displays the commands supported by the bm tool.|
33
34Example
35
36
37```bash
38# Display the help information.
39bm help
40```
41
42
43## Installation Command
44
45```bash
46bm install [-h] [-p path] [-u userId] [-r] [-w waitting-time]
47```
48
49
50**Table 3** Installation command parameters
51
52| Name| Mandatory| Description|
53| -------- | -------- | -------- |
54| -h | No| Used to display the parameters supported by the **install** command. By default, the help information is displayed.|
55| -p | Yes| Path of the HAP to install. You can specify a path to install one or more HAPs at the same time.|
56| -u | No| User whose HAP is to be installed. By default, the current user's HAP is installed.|
57| -r | No| Whether to install the HAP in overwrite mode. By default, the HAP is installed in overwrite mode.|
58| -w | No| Time that the Bundle Manager tool waits before installing the HAP. The minimum waiting time is 5s, and the maximum waiting time is 600s. The default waiting time is 5s.|
59
60
61Example
62
63```bash
64bm install -p /data/app/ohosapp.hap -u 100 -w 5s -r
65// The execution result is as follows:
66install bundle successfully.
67```
68
69
70## Uninstall Command
71
72```bash
73bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k]
74```
75
76
77**Table 4** Uninstall command parameters
78
79| Name| Mandatory| Description|
80| -------- | -------- | -------- |
81| -h | No| Used to display the parameters supported by the **uninstall** command. By default, the help information is displayed.|
82| -n | Yes| Name of the bundle to uninstall.|
83| -m | No| Module of the bundle to uninstall. By default, all modules are uninstalled.|
84| -u | No| User whose bundle is to be uninstalled. By default, the current user's bundle is uninstalled.|
85| -k | No| Whether the application data is retained when the bundle is uninstalled. By default, the application data is deleted along the uninstall.|
86| -v | No| Version number of the shared bundle. By default, all shared bundles with the specified bundle name are uninstalled.|
87
88
89Example
90
91```bash
92bm uninstall -n com.ohos.app -m com.ohos.app.EntryAbility -u 100 -k
93// The execution result is as follows:
94uninstall bundle successfully.
95```
96
97
98## Dump Command
99
100```bash
101bm dump [-h help] [-a] [-n bundleName] [-s shortcutInfo] [-u userId] [-d deviceId]
102```
103
104
105If **-u** is not specified, the command applies to all users.
106
107
108**Table 5** Dump command parameters
109
110| Name| Mandatory| Description|
111| -------- | -------- | -------- |
112| -h | No| Used to display the parameters supported by the **dump** command. By default, the help information is displayed.|
113| -a | Yes| Used to display all bundles installed in the system.|
114| -n | Yes| Used to display the details of a bundle.|
115| -s | Yes| Used to display the shortcut information of a bundle.|
116| -d | No| Used to display the bundle information on a given device. By default, the bundle information on the current device is queried.|
117| -u | No| Used to display the bundle information for a given user. By default, the bundle information of the current user is queried.|
118
119
120Example
121
122```bash
123# Display the names of all bundles installed in the system.
124bm dump -a
125# Display the details of a bundle.
126bm dump -n com.ohos.app -u 100
127# Display the shortcut information of a bundle.
128bm dump -s com.ohos.app -u 100
129# Display cross-device bundle information.
130bm dump -n com.ohos.app -d xxxxx
131```
132
133
134## Clean Command
135
136```bash
137bm clean [-h] [-c] [-n  bundleName] [-d] [-u userId]
138```
139
140
141If **-u** is not specified, the command applies to all active users.
142
143
144**Table 6** Clean command parameters
145
146| Name| Description|
147| -------- | -------- |
148| -h | Used to display the parameters supported by the **clean** command.|
149| -c -n | Used to clear the cache data of a bundle.|
150| -d -n | Used to clear the data directory of a bundle.|
151| -u | Used to clear the cache data of a bundle for a given user.|
152
153
154Example
155
156```bash
157# Clear the cache data of a bundle.
158bm clean -c -n com.ohos.app -u 100
159// The execution result is as follows:
160clean bundle cache files successfully.
161# Clear the user data of a bundle.
162bm clean -d -n com.ohos.app -u 100
163// The execution result is as follows:
164clean bundle data files successfully.
165```
166
167
168## Enable Command
169
170```bash
171bm enable [-h] [-n bundleName] [-a abilityName] [-u userId]
172```
173
174
175If **-u** is not specified, the command applies to all active users.
176
177
178**Table 7** Enable command parameters
179
180| Name| Description|
181| -------- | -------- |
182| -h | Used to display the parameters supported by the **enable** command.|
183| -n | Used to enable a bundle.|
184| -a | Used to enable an ability with a specified bundle name.|
185| -u | Used to enable a bundle for a given user.|
186
187
188Example
189
190```bash
191# Enable a bundle.
192bm enable -n com.ohos.app -a com.ohos.app.EntryAbility -u 100
193// The execution result is as follows:
194enable bundle successfully.
195```
196
197
198## Disable Command
199
200```bash
201bm disable [-h] [-n bundleName] [-a abilityName] [-u userId]
202```
203
204
205If **-u** is not specified, the command applies to all active users.
206
207
208**Table 8** Disabled command parameters
209
210| Name| Description|
211| -------- | -------- |
212| -h | Used to display the parameters supported by the **disable** command.|
213| -n | Used to disable a bundle.|
214| -a | Used to disable an ability with a specified bundle name.|
215| -u | Used to disable a bundle for a given user.|
216
217Example
218
219```bash
220# Disable a bundle.
221bm disable -n com.ohos.app -a com.ohos.app.EntryAbility -u 100
222// The execution result is as follows:
223disable bundle successfully.
224```
225
226
227## Obtaining UDID
228
229```bash
230bm get [-h] [-u]
231```
232
233
234**Table 9** Parameters used in the command for obtaining the UDID
235
236| Name| Description|
237| -------- | -------- |
238| -h | Used to display the parameters supported by the **get** command.|
239| -u | Used to obtain the UDID of a device.|
240
241
242Example
243
244```bash
245# Obtain the UDID of a device.
246bm get -u
247// The execution result is as follows:
248udid of current device is :
24923CADE0C
250```
251
252
253## Quick Fix
254
255```bash
256bm quickfix [-h] [-a -f filePath] [-q -b bundleName]
257```
258
259
260**Table 10** Parameters used in the command for quick fix
261
262| Name| Description|
263| -------- | -------- |
264| -h | Used to display the commands supported by **quickfix**.|
265| -a -f | Used to run the quick fix patch installation command. **file-path** corresponds to the hqf file. You can pass in one or more hqf files or the directory where the hqf file is located.|
266| -q -b | Used to display the patch information based on the bundle name. **bundle-name** indicates the bundle name.|
267
268
269Example
270
271```bash
272# Display patch package information by the bundle name.
273bm quickfix -q -b com.ohos.app
274// The execution result is as follows:
275// Information as follows:
276// ApplicationQuickFixInfo:
277//  bundle name: com.ohos.app
278//  bundle version code: xxx
279//  bundle version name: xxx
280//  patch version code: x
281//  patch version name:
282//  cpu abi:
283//  native library path:
284//  type:
285# Patch installation in the quick fix:
286bm quickfix -a -f /data/app/
287// The execution result is as follows:
288apply quickfix succeed.
289```
290
291## Commands for Querying the Shared Library
292
293```bash
294bm dump-shared [-h help] [-a] [-n bundleName] [-m moudleName]
295```
296
297  **Table 11** Commands for querying the shared library
298
299| Name                                            | Description                                  |
300| ------------------------------------------------ | -------------------------------------- |
301| bm dump-shared -h                                | Displays the parameters supported by the **dump-shared** command.         |
302| bm dump-shared -a                                | Displays all shared libraries installed in the system.            |
303| bm dump-shared -n                                | Displays details about a shared library.          |
304| bm dump-dependencies -h                          | Displays the parameters supported by the **bm dump-dependencies** command.|
305| bm dump-dependencies -n bundleName -m moudleName | Displays information about the shared library on which a specified module of an application depends.  |
306
307Example
308
309```bash
310# Display the bundle names of all shared libraries installed in the system.
311bm dump-shared -a
312# Display the details about the specified shared library.
313bm dump-shared -n com.ohos.lib
314# Display information about the shared library on which a specified module of an application depends.
315bm dump-dependencies -n com.ohos.app -m entry
316```
317
318## FAQs
319
320### Error Message "code:9568320 error: no signature file" Is Displayed During HAP Installation
321
322**Symptom**
323
324When you run a signed HAP, the error message "failed to install bundle. error: install no signature info" or "failed to install bundle. error: no signature file" is displayed.
325
326![Example](figures/en-us_image_0000001389116960.png)
327
328**Solution**
329
330An unsigned HAP is installed. To solve this problem, sign the HAP before installing it.
3311. Use automatic signature. After the device is connected, sign the application again.
3322. To use manual signature, follow the instructions provided in [hapsigner Guide](../security/hapsigntool-guidelines.md).
333
334### Error Message "code:9568347 error: install parse native so failed" Is Displayed During HAP Installation
335
336**Symptom**
337
338When you start debugging or run a C++ application, the error message "error: install parse native so failed" is displayed during the installation of the HAP.
339
340**Solution**
341
342The ABI type configured for the C++ project does not match that supported by the device. To solve this problem, perform the following steps:
343
3441. Connect the device to DevEco Studio.
3452. Open the command line tool and go to the **toolchains\{*Version*}** directory in the OpenHarmony SDK installation directory.
346
347   To check the OpenHarmony SDK installation directory, choose **File** > **Settings** > **SDK**.
348
3493. Run the following command to obtain the list of ABI types supported by the device, which include one or more of the following: default, armeabi-v7a, armeabi, arm64-v8a, x86, and x86_64.
350    ```
351    hdc shell
352    param get const.product.cpu.abilist
353    ```
3544. Depending on the obtained list, modify the **abiFilters** settings in the module-level **build-profile.json5** file. The rules are as follows:
355    * If the list includes only **default**, run the following command to check whether the **lib64** folder exists:
356      ```
357      cd /system/
358      ls
359      ```
360
361      ![Example](figures/en-us_image_0000001609001262.png)
362
363      * If the **lib64** folder exists, add the arm64-v8a type to **abiFilters**.
364      * If the **lib64** folder does not exist, add armeabi, armeabi-v7a, or both types to **abiFilters**.
365    * If the list includes one or more of the following, add at least one of them to **abiFilters**: armeabi-v7a, armeabi, arm64-v8a, x86, and x86_64.
366
367### Error Message "code:9568344 error: install parse profile prop check error" Is Displayed During HAP Installation
368
369**Symptom**
370
371When you start debugging or run an application, the error message "error: install parse profile prop check error" is displayed during the installation of the HAP.
372
373![Example](figures/en-us_image_0000001585361412.png)
374
375**Solution**
376
377The signature file of the application is changed, but the new signature fingerprint is not reconfigured in the **install_list_capability.json** file of the device. To solve this problem, perform the following steps:
378
3791. Obtain the new signature fingerprint.
380
381    a. Obtain the storage path of the signature file, which is the value of **profile** in the **signingConfigs** field in the project-level **build-profile.json5** file.
382
383    b. Open the signature file (with the file name extension .p7b), search for **development-certificate** in the file, copy **-----BEGIN CERTIFICATE-----**, **-----END CERTIFICATE-----**, and the information between them to a new text file, delete the newline characters, and save the file as a new .cer file.
384
385    The format of the new .cer file is shown below. (The file content is an example.)
386
387    ![Example](figures/en-us_image_0000001585521364.png)
388
389    c. Use the keytool (available in the **jbr/bin** folder of the DevEco Studio installation directory) to obtain the SHA-256 value of the certificate fingerprint from the .cer file:
390
391      ```
392      keytool -printcert -file xxx.cer
393      ```
394    d. Remove the colon (:) from the SHA-256 content in the certificate fingerprint. What you get is the signature fingerprint.
395
396    An example SHA-256 value is shown below.
397
398    ![Example](figures/en-us_image_0000001635921233.png)
399
400    The signature fingerprint obtained by removing the colon is 5753DDBC1A8EF88A62058A9FC4B6AFAFC1C5D8D1A1B86FB3532739B625F8F3DB.
401
4022. Obtain the **install_list_capability.json** file of the device.
403
404    a. Connect the device.
405
406    b. Run the following command to view the **install_list_capability.json** file of the device:
407    ```
408    find /system -name install_list_capability.json
409    ```
410    The **install_list_capability.json** file of the device is stored in the following directory. Find the corresponding configuration file based on the bundle name.
411    ```
412    /system/etc/app/install_list_capability.json
413    ```
414    c. Run the following command to obtain the **install_list_capability.json** file:
415    ```
416    hdc shell mount -o rw,remount /
417    hdc file recv /system/etc/app/install_list_capability.json
418    ```
419
4203. Add the signature fingerprint obtained to **app_signature** in the **install_list_capability.json** file. Note that the signature fingerprint must be configured under the corresponding bundle name.
421
422   ![Example](figures/en-us_image_0000001635641893.png)
423
4244. Push the modified **install_list_capability.json** file to the device and restart the device.
425
426    ```
427    hdc shell mount -o rw,remount /
428    hdc file send install_list_capability.json /system/etc/app/install_list_capability.json
429    hdc shell chmod 777 /system/etc/app/install_list_capability.json
430    hdc shell reboot
431    ```
432
4335. Reinstall the application.
434
435### Error Message "code:9568305 error: dependent module does not exist" Is Displayed During HAP Installation
436
437**Symptom**
438
439When you start debugging or run an application, the error message "error: dependent module does not exist" is displayed during the installation of the HAP.
440
441![Example](figures/en-us_image_0000001560338986.png)
442
443**Solution**
444
445The SharedLibrary module on which the application depends is not installed. To solve this problem, perform the following steps:
446
447* Install the dependent SharedLibrary module. On the **Run/Debug Configurations** page of DevEco Studio, select **Keep Application Data** on the **General** tab page, and click **OK** to save the configuration. Then run or debug the application again.
448
449   ![Example](figures/en-us_image_0000001560201786.png)
450
451* On the **Run/Debug Configurations** page of DevEco Studio, click the **Deploy Multi Hap** tab, select **Deploy Multi Hap Packages**, select the dependent module SharedLibrary, and click **OK** to save the configuration. Then run or debug the application again.
452
453   ![Example](figures/en-us_image_0000001610761941.png)
454
455### Error Message "code:9568259 error: install parse profile missing prop" Is Displayed During HAP Installation
456
457**Symptom**
458
459When you start debugging or run an application, the error message "error: install parse profile missing prop" is displayed during the installation of the HAP.
460
461![Example](figures/en-us_image_0000001559130596.png)
462
463**Solution**
464
465Some mandatory fields are missing in the **app.json5** and **module.json5** files.
466
467* Method 1: Check and add mandatory fields by referring to the [app.json5 file](../../application-dev/quick-start/app-configuration-file.md) and [module.json5 file](../../application-dev/quick-start/module-configuration-file.md).
468* Method 2: Determine the missing fields based on the HiLog.
469
470    Run the following command to enable disk flushing:
471    ```
472    hilog -w start
473    ```
474
475    Disk location: /data/log/hilog
476
477    Open the log file and find **profile prop %{public}s is mission**. For example, **profile prop icon is mission** indicates that the **icon** field is missing.
478
479### Error Message "code:9568258 error: install releaseType target not same" Is Displayed During HAP Installation
480
481**Symptom**
482
483When you start debugging or run an application, the error message "error: install releaseType target not same" is displayed during the installation of the HAP.
484
485![Example](figures/en-us_image_0000001609976041.png)
486
487**Solution**
488
489The value of **releaseType** in the SDK used by the existing HAP is different from that used by the new HAP. Uninstall the existing HAP on the device, and then install the new HAP.
490
491### Error Message "code:9568322 error: signature verification failed due to not trusted app source" Is Displayed During HAP Installation
492
493**Symptom**
494
495When you start debugging or run an application, the error message "error: signature verification failed due to not trusted app source" is displayed during the installation of the HAP.
496
497![Example](figures/en-us_image_0000001585042216.png)
498
499**Solution**
500
501The signature does not contain the UDID of the debugging device. To solve this problem, perform the following steps:
502
503* Use automatic signature. After the device is connected, sign the application again.
504* If manual signature is used, add the UDID of the device to the **UnsgnedDebugProfileTemplate.json** file. For details, see [OpenHarmony Application Manual Signature](../security/hapsigntool-guidelines.md).
505  ```
506  // Command for obtaining the UDID
507  hdc shell bm get -u
508  ```
509
510### Error Message "code:9568289 error: install failed due to grant request permissions failed" Is Displayed During HAP Installation
511
512**Symptom**
513
514When you start debugging or run an application, the error message "error: install failed due to grant request permissions failed" is displayed during the installation of the HAP.
515
516![Example](figures/en-us_image_0000001585201996.png)
517
518**Solution**
519
520The application uses the default Ability Privilege Level (APL), which is normal, and requires the system_basic or system_core permission.
521
522Change the API in the **UnsgnedDebugProfileTemplate.json** file to **system_basic** or **system_core**, and sign and pack the application again.
523
524### Error Message "code:9568297 error: install failed due to older sdk version in the device" Is Displayed During HAP Installation
525
526**Symptom**
527
528When you start debugging or run an application, the error message "error: install failed due to older sdk version in the device" is displayed during the installation of the HAP.
529
530![Example](figures/en-us_image_0000001635521909.png)
531
532**Solution**
533
534The SDK version used for build and packing does not match the device image version. The possible scenarios are as follows:
535
536* Scenario 1: The device image version is earlier than the SDK version for build and packing. Update the device image version. Run the following command to query the device image version:
537  ```
538  hdc shell param get const.ohos.apiversion
539  ```
540  If the API version provided by the image is 10 and the SDK version used for application build is also 10, the possible cause is that the image version is too early to be compatible with the SDK verification rules of the new version. In this case, update the image version to the latest version.
541
542* Scenario 2: For applications that need to run on OpenHarmony devices, ensure that runtimeOS has been changed to OpenHarmony.
543
544### Error Message "code:9568332 error: install sign info inconsistent" Is Displayed During HAP Installation
545
546**Symptom**
547
548When you start debugging or run an application, the error message "error: install sign info inconsistent" is displayed during the installation of the HAP.
549
550![Example](figures/en-us_image_0000001635761329.png)
551
552**Solution**
553
554The signature of the application installed on the device is different from that of the new application. **Keep Application Data** is selected in **Edit Configurations** (the application is installed without being uninstalled) and the signature is re-signed.
555
556Uninstall the application, or deselect **Keep Application Data**. Then install the new application.
557