From daa705c74c534b78021c472bcf8af2f7e6f6e0bb Mon Sep 17 00:00:00 2001 From: xiaozuo00 Date: Mon, 24 Mar 2025 23:02:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E3=80=81=E5=8D=B8=E8=BD=BD=E3=80=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaozuo00 --- .../quick-start/app-configuration-file.md | 2 +- .../apis-ability-kit/errorcode-bundle.md | 95 +++++++++ ...apis-bundleManager-pluginBundleInfo-sys.md | 40 ++++ .../js-apis-bundleManager-sys.md | 101 +++++++++- .../apis-ability-kit/js-apis-installer-sys.md | 160 +++++++++++++++ zh-cn/application-dev/tools/bm-tool.md | 190 ++++++++++++++++++ 6 files changed, 586 insertions(+), 2 deletions(-) create mode 100644 zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-pluginBundleInfo-sys.md diff --git a/zh-cn/application-dev/quick-start/app-configuration-file.md b/zh-cn/application-dev/quick-start/app-configuration-file.md index 0415383518c..424b1a21c50 100644 --- a/zh-cn/application-dev/quick-start/app-configuration-file.md +++ b/zh-cn/application-dev/quick-start/app-configuration-file.md @@ -57,7 +57,7 @@ app.json5配置文件包含以下标签。 | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | | bundleName | 标识应用的Bundle名称,用于标识应用的唯一性。命名规则如下 :
- 必须为以点号(.)分隔的字符串,且至少包含三段,每段中仅允许使用英文字母、数字、下划线(_)。
- 首段以英文字母开头,非首段以数字或英文字母开头,每一段以数字或者英文字母结尾。
- 不允许多个点号(.)连续出现。
- 字符串最小长度为7字节,最大长度128字节。
- 推荐采用反域名形式命名(如“com.example.demo”,建议第一级为域名后缀com,第二级为厂商/个人名,第三级为应用名,也可以多级)。
对于随系统源码编译的应用,建议命名为“com.ohos.demo”形式,其中的ohos标识系统应用。 | 字符串 | 该标签不可缺省。 | -| bundleType| 标识应用的Bundle类型,用于区分应用或者原子化服务。支持的取值如下:
- app:当前Bundle为应用。
- atomicService:当前Bundle为原子化服务。
- shared:当前Bundle为共享库应用,预留字段。
- appService:当前Bundle为系统级共享库应用,仅供系统应用使用。 | 字符串| 该标签可缺省,缺省值为app。 | +| bundleType| 标识应用的Bundle类型,用于区分应用或者原子化服务。支持的取值如下:
- app:当前Bundle为应用。
- atomicService:当前Bundle为原子化服务。
- shared:当前Bundle为共享库应用,预留字段。
- appService:当前Bundle为系统级共享库应用,仅供系统应用使用。
- appPlugin:当前Bundle为应用的插件包。从API version 19开始,支持该字段。 | 字符串| 该标签可缺省,缺省值为app。 | | debug | 标识应用是否可调试。
- true:可调试,一般用于开发阶段。
- false:不可调试,一般用于发布阶段。 | 布尔值 | 由DevEco Studio编译构建时生成。该标签可缺省,缺省值为false。 | | [icon](#icon标签) | 标识[应用的图标](../application-models/application-component-configuration-stage.md),取值为图标资源文件的索引。 | 字符串 | 该标签不可缺省。 | | label | 标识[应用的名称](../application-models/application-component-configuration-stage.md),取值为字符串资源的索引,字符串长度不超过63字节。 | 字符串 | 该标签不可缺省。 | diff --git a/zh-cn/application-dev/reference/apis-ability-kit/errorcode-bundle.md b/zh-cn/application-dev/reference/apis-ability-kit/errorcode-bundle.md index e69ba7c9e8d..b7883b6f080 100644 --- a/zh-cn/application-dev/reference/apis-ability-kit/errorcode-bundle.md +++ b/zh-cn/application-dev/reference/apis-ability-kit/errorcode-bundle.md @@ -1133,6 +1133,101 @@ System error occurred during copy execution. **处理步骤**
1. 检查目标路径空间是否充足。 2. 检查源路径文件是否存在。 + +## 17700087 当前设备不支持安装插件 + +**错误信息**
+Failed to install the plugin because the current device does not support plugin. + +**错误描述**
+当前设备不支持插件能力。 + +**可能原因**
+设备不具备插件能力,安装插件失败。 + +**处理步骤**
+使用[param工具](../../tools/param-tool.md)设置const.bms.support_plugin的值为true,即执行hdc shell param set const.bms.support_plugin true。 + +## 17700088 应用缺少安装插件的权限 + +**错误信息**
+Failed to install the plugin because the host application lacks ohos.permission.kernel.SUPPORT_PLUGIN. + +**错误描述**
+应用缺少ohos.permission.kernel.SUPPORT_PLUGIN权限,安装插件失败。 + +**可能原因**
+1. 应用没有申请ohos.permission.kernel.SUPPORT_PLUGIN权限。 +2. 应用申请了该权限,但是权限没有生效。 + +**处理步骤**
+1. 参考[权限申请指导](../../security/AccessToken/declare-permissions.md)申请[ohos.permission.kernel.SUPPORT_PLUGIN权限](../../security/AccessToken/restricted-permissions.md#ohospermissionkernelsupport_plugin)。 +2. 该权限等级为system_basic,若[应用APL等级](../../security/AccessToken/app-permission-mgmt-overview.md#权限机制)低于system_basic,请[申请受限权限](../../security/AccessToken/declare-permissions-in-acl.md)。 + +## 17700089 插件的 pluginDistributionIDs 解析失败 + +**错误信息**
+Failed to install the plugin because the plugin id fails to be parsed. + +**错误描述**
+解析插件profile签名文件中的pluginDistributionIDs失败,插件安装失败。 + +**可能原因**
+插件应用签名文件中的pluginDistributionIDs配置不符合规范。 + +**处理步骤**
+参考如下格式,重新配置插件profile签名文件中的"app-services-capabilities"字段。 +``` +"app-services-capabilities":{ + "ohos.permission.kernel.SUPPORT_PLUGIN":{ + "pluginDistributionIDs":"value-1|value-2|···" + } +} +``` + + +## 17700090 插件与应用之间 pluginDistributionIDs 校验失败 + +**错误信息**
+Failed to install the plugin because the plugin id fails to be verified. + +**错误描述**
+插件与应用的pluginDistributionIDs之间没有共同值,校验失败,该应用上无法安装这个插件。 + +**可能原因**
+插件与应用的pluginDistributionIDs之间没有共同值。 + +**处理步骤**
+重新配置应用或者插件[签名证书profile文件](https://developer.huawei.com/consumer/cn/doc/app/agc-help-add-releaseprofile-0000001914714796)中的pluginDistributionIDs。 + +## 17700091 插件与主体同包名 + +**错误信息**
+Failed to install the plugin because the plugin name is same as host bundle name. + +**错误描述**
+插件的包名与应用的包名一致,不符合插件与应用之间异包名的规格,安装插件失败。 + +**可能原因**
+插件的包名与应用的包名一致。 + +**处理步骤**
+重新配置插件的包名。 + +## 17700092 插件包名不存在 + +**错误信息**
+Failed to uninstall the plugin because the specified plugin is not found. + +**错误描述**
+插件包名不存在,导致插件卸载时失败。 + +**可能原因**
+插件没有在应用中安装。 + +**处理步骤**
+使用[bm dump -n 命令](../../tools/bm-tool.md#查询应用信息命令dump)查询应用信息,确认插件是否安装。 + ## 17700101 包管理服务异常 diff --git a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-pluginBundleInfo-sys.md b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-pluginBundleInfo-sys.md new file mode 100644 index 00000000000..87b89872943 --- /dev/null +++ b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-pluginBundleInfo-sys.md @@ -0,0 +1,40 @@ +# PluginBundleInfo (系统接口) + +插件信息,通过接口[bundleManager.getAllPluginInfo](js-apis-bundleManager-sys.md#bundlemanagergetallplugininfo19)获取。 + +> **说明:** +> +> 本模块首批接口从API version 19 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> 本模块为系统接口。 + +## PluginBundleInfo +插件信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 只读 | 可选 | 说明 | +| -------------- | ------ | ---- | ---- | -------------- | +| label | string | 是 | 是 | 插件的名称。 | +| labelId | number | 是 | 是 | 插件名称的资源id值。 | +| icon | string | 是 | 是 | 插件的图标。 | +| iconId | number | 是 | 是 | 插件图标的资源id值。 | +| pluginBundleName | string | 是 | 是 | 安装插件的应用包名。 | +| versionCode | string | 是 | 是 | 插件的版本号。 | +| versionName | string | 是 | 是 | 插件的版本名称。 | +| pluginModuleInfos | Array<[PluginModuleInfo](js-apis-bundleManager-pluginBundleInfo-sys.md#pluginmoduleinfo)> | 是 | 是 | 插件的模块信息。 | + +## PluginModuleInfo +插件的模块信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 只读 | 可选 | 说明 | +| -------------- | ------ | ---- | ---- | -------------- | +| moduleName | string | 是 | 是 | 插件模块的名称。 | +| descriptionId | number | 是 | 是 | 插件模块描述的资源id值。 | +| description | string | 是 | 是 | 插件模块的描述信息。 | diff --git a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-sys.md b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-sys.md index 24fef1ed687..a5ae2e090aa 100644 --- a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-sys.md +++ b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-bundleManager-sys.md @@ -5010,6 +5010,81 @@ try { } ``` +## bundleManager.getAllPluginInfo19+ + +function getAllPluginInfo(hostBundleName: string, userId?: number): Promise> + +根据给定的hostBundleName和userId获取所有的PluginBundleInfo,使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| hostBundleName | string | 是 | 表示安装插件的应用包名。 | +| userId | number | 否 | 表示用户ID,默认值:调用方所在用户ID。取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | -------------------------------------- | +| Promise> | Promise对象,返回Array\。 | + +**错误码:** + +以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 201 | Permission denied. | +| 202 | Permission denied, non-system app called system api. | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified user ID is not found. | + +**示例:** + +```ts +import { bundleManager } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +let hostBundleName = 'com.ohos.demo'; +let userId = 100; + +try { + bundleManager.getAllPluginInfo(hostBundleName, userId).then((data) => { + hilog.info(0x0000, 'testTag', 'getAllPluginInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', 'getAllPluginInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + let message = (err as BusinessError).message; + hilog.error(0x0000, 'testTag', 'getAllPluginInfo failed. Cause: %{public}s', message); +} +``` + +```ts +import { bundleManager } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +let hostBundleName = 'com.ohos.demo'; + +try { + bundleManager.getAllPluginInfo(hostBundleName).then((data) => { + hilog.info(0x0000, 'testTag', 'getAllPluginInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', 'getAllPluginInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + let message = (err as BusinessError).message; + hilog.error(0x0000, 'testTag', 'getAllPluginInfo failed. Cause: %{public}s', message); +} +``` + ## bundleManager.getExtResource12+ getExtResource(bundleName: string): Promise\>; @@ -5647,4 +5722,28 @@ try { let message = (err as BusinessError).message; hilog.error(0x0000, 'testTag', 'deleteAbc failed. Cause: %{public}s', message); } -``` \ No newline at end of file +``` + +## PluginBundleInfo19+ + +type PluginBundleInfo = _PluginBundleInfo + +插件信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +| 类型 | 说明 | +| ------------------------------------------------------------ | -------------- | +| [_PluginBundleInfo](js-apis-bundleManager-pluginBundleInfo-sys.md#pluginbundleinfo) |插件信息。 | + +## PluginModuleInfo19+ + +type PluginModuleInfo = _PluginModuleInfo + +插件的模块信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +| 类型 | 说明 | +| ------------------------------------------------------------ | -------------- | +| [_PluginModuleInfo](js-apis-bundleManager-pluginBundleInfo-sys.md#pluginmoduleinfo) |插件的模块信息。 | diff --git a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-installer-sys.md b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-installer-sys.md index 5e621aa2626..4a8f7d31fd2 100644 --- a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-installer-sys.md +++ b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-installer-sys.md @@ -1655,6 +1655,153 @@ try { } ``` +## BundleInstaller.installPlugin19+ + +installPlugin(hostBundleName: string, pluginFilePaths: Array\, pluginParam?: PluginParam): Promise\ + +应用安装插件,使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_PLUGIN_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| hostBundleName | string | 是 | 待安装插件的应用包名。 | +| pluginFilePaths | Array\ | 是 | 存储插件程序包的路径。当传入多个文件路径或者一个目录时,需确保这些文件是同一插件程序的HSP,且这些HSP的签名需要保持一致。 | +| pluginParam | [PluginParam](#pluginparam19) | 否 | 指定安装插件所需的参数,默认值:参照 [PluginParam](#pluginparam19) 的默认值。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | -------------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 201 | Calling interface without permission 'ohos.permission.INSTALL_PLUGIN_BUNDLE'. | +| 202 | Permission verification failed. A non-system application calls a system API. | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| +| 17700001 | The specified bundleName cannot be found. | +| 17700004 | The userId is invalid. | +| 17700010 | Failed to install the plugin because the plugin fails to be parsed. | +| 17700011 | Failed to install the plugin because the plugin signature fails to be verified. | +| 17700012 | Failed to install the plugin because the HSP path is invalid or the HSP is too large. | +| 17700015 | Failed to install the plugin because they have different configuration information. | +| 17700016 | Failed to install the plugin because of insufficient system disk space. | +| 17700017 | Failed to install the plugin since the version of the plugin to install is too early. | +| 17700048 | Failed to install the plugin because the code signature verification is failed. | +| 17700052 | Failed to install the plugin because debug bundle cannot be installed under non-developer mode. | +| 17700073 | Failed to install the plugin because a plugin with the same bundle name but different signature information exists on the device. | +| 17700087 | Failed to install the plugin because the current device does not support plugin. | +| 17700088 | Failed to install the plugin because the host application lacks ohos.permission.kernel.SUPPORT_PLUGIN. | +| 17700089 | Failed to install the plugin because the plugin id fails to be parsed. | +| 17700090 | Failed to install the plugin because the plugin id fails to be verified. | +| 17700091 | Failed to install the plugin because the plugin name is same as host bundle name. | + +**示例:** +```ts +import { installer } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +let hostBundleName = 'com.example.application'; +let pluginFilePaths = ['/data/bms_app_install/test.hsp']; +let pluginParam : installer.PluginParam = { + userId : 100, +}; + +try { + installer.getBundleInstaller().then((data: installer.BundleInstaller) => { + data.installPlugin(hostBundleName, pluginFilePaths, pluginParam) + .then(() => { + console.info('installPlugin successfully.'); + }).catch((error: BusinessError) => { + console.error('installPlugin failed:' + error.message); + }); + }).catch((error: BusinessError) => { + console.error('installPlugin failed. Cause: ' + error.message); + }); +} catch (error) { + let message = (error as BusinessError).message; + console.error('getBundleInstaller failed. Cause: ' + message); +} +``` + +## BundleInstaller.uninstallPlugin19+ + +uninstallPlugin(hostBundleName: string, pluginBundleName: string, pluginParam?: PluginParam): Promise\ + +应用卸载插件,使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.UNINSTALL_PLUGIN_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| hostBundleName | string | 是 | 待卸载插件的应用包名。 | +| pluginBundleName | string | 是 | 插件的包名。 | +| pluginParam | [PluginParam](#pluginparam19) | 否 | 指定卸载插件所需的参数,默认值:参照 [PluginParam](#pluginparam19) 的默认值。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | -------------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 201 | Calling interface without permission 'ohos.permission.UNINSTALL_PLUGIN_BUNDLE'. | +| 202 | Permission verification failed. A non-system application calls a system API. | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| +| 17700001 | The specified bundleName cannot be found. | +| 17700004 | The userId is invalid. | +| 17700092 | Failed to uninstall the plugin because the specified plugin is not found. | + +**示例:** +```ts +import { installer } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +let hostBundleName = 'com.example.application'; +let pluginBundleName = 'com.ohos.pluginDemo'; +let pluginParam : installer.PluginParam = { + userId : 100, +}; + +try { + installer.getBundleInstaller().then((data: installer.BundleInstaller) => { + data.uninstallPlugin(hostBundleName, pluginBundleName, pluginParam) + .then(() => { + console.info('uninstallPlugin successfully.'); + }).catch((error: BusinessError) => { + console.error('uninstallPlugin failed:' + error.message); + }); + }).catch((error: BusinessError) => { + console.error('uninstallPlugin failed. Cause: ' + error.message); + }); +} catch (error) { + let message = (error as BusinessError).message; + console.error('getBundleInstaller failed. Cause: ' + message); +} +``` + ## HashParam 应用程序安装卸载哈希参数信息。 @@ -1768,3 +1915,16 @@ PGO(Profile-guided Optimization)配置文件参数信息。 | ----------- | ------ | ---- | ------------------------------------------------------------ | | userId | number | 否 | 指定删除分身应用所在的用户id,可以通过[getOsAccountLocalId接口](../apis-basic-services-kit/js-apis-osAccount.md#getosaccountlocalid9)获取。默认值:调用方所在用户。 | | parameters | Array<[Parameters](#parameters15)> | 否 | 指定删除分身应用扩展参数,默认值为空。 | + +## PluginParam19+ + +插件应用安装、卸载的参数信息。 + + **系统能力:** SystemCapability.BundleManager.BundleFramework.Core + + **系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ------------------------------------------------------------ | +| userId | number | 否 | 指定安装、卸载插件程序所在的用户id。默认值:调用方所在用户。 | +| parameters | Array<[Parameters](#parameters15)> | 否 | 指定安装、卸载插件程序的扩展参数,默认值为空。 | \ No newline at end of file diff --git a/zh-cn/application-dev/tools/bm-tool.md b/zh-cn/application-dev/tools/bm-tool.md index 73c767a5566..b614ceef755 100644 --- a/zh-cn/application-dev/tools/bm-tool.md +++ b/zh-cn/application-dev/tools/bm-tool.md @@ -25,6 +25,8 @@ Bundle Manager(包管理工具,简称bm)是实现应用安装、卸载、 | dump-shared | 查询应用间HSP应用信息。 | | dump-overlay | 打印overlay应用的overlayModuleInfo。 | | dump-target-overlay | 打印目标应用的所有关联overlay应用的overlayModuleInfo。 | +| install-plugin | 安装插件命令,用于安装插件。| +| uninstall-plugin | 卸载插件命令,用于卸载插件。| ## 帮助命令(help) @@ -429,6 +431,51 @@ bm dump-target-overlay-b com.ohos.app bm dump-target-overlay -b com.ohos.app -m entry ``` +## 安装插件命令(install-plugin) + +```bash +bm install-plugin [-h] [-n hostBundleName] [-p filePath] +``` + +**install-plugin命令参数列表** +| 参数 | 参数说明 | +| -------- | -------- | +| -h | 帮助信息。 | +| -n | 必选参数,指定待安装插件的应用包名。| +| -p | 必选参数,指定插件文件路径。| + +示例: + +```bash +# 安装一个插件 +bm install-plugin -n com.ohos.app -p /data/plugin.hsp +``` +> **说明:** +> +> 在同一个应用中安装同一个插件,则视作插件版本更新,插件不支持降级安装;插件版本更新后,需要重启应用插件才能生效。 + + +## 卸载插件命令(uninstall-plugin) + +```bash +bm uninstall-plugin [-h] [-n hostBundleName] [-p pluginBundleName] +``` + +**uninstall-plugin命令参数列表** +| 参数 | 参数说明 | +| -------- | -------- | +| -h | 帮助信息。 | +| -n | 必选参数,指定应用包名。| +| -p | 必选参数,指定插件的包名。| + +示例: + +```bash +# 卸载一个插件 +bm uninstall-plugin -n com.ohos.app -p com.ohos.plugin +``` + + ## bm工具错误码 ### 301 系统账号不存在 @@ -2596,3 +2643,146 @@ error: Installd get proxy error. # 导出日志文件 hdc file recv /data/log/hilog/ ``` +### 9568432 插件与应用之间的 pluginDistributionIDs 校验失败,导致安装失败 +**错误信息** + +error: Check pluginDistributionID between plugin and host application failed. + +**错误描述** + +应用与插件的 pluginDistributionIDs 之间校验失败。 + +**可能原因** + +应用与插件的 pluginDistributionIDs 没有共同值,导致校验失败。 + +**处理步骤** + +重新配置应用或者插件[签名证书profile文件](https://developer.huawei.com/consumer/cn/doc/app/agc-help-add-releaseprofile-0000001914714796)中的 pluginDistributionIDs。 + +### 9568433 应用缺少ohos.permission.SUPPORT_PLUGIN权限 +**错误信息** + +error: Failed to install the plugin because host application check permission failed. + +**错误描述** + +应用安装插件时,应用的权限校验失败。 + +**可能原因** + +应用缺少ohos.permission.SUPPORT_PLUGIN权限。 + +**处理步骤** + +1. 参考[权限申请指导](../security/AccessToken/declare-permissions.md)申请[ohos.permission.kernel.SUPPORT_PLUGIN权限](../security/AccessToken/restricted-permissions.md#ohospermissionkernelsupport_plugin)。 +2. 该权限等级为system_basic,若[应用APL等级](../security/AccessToken/app-permission-mgmt-overview.md#权限机制)低于system_basic,请[申请受限权限](../security/AccessToken/declare-permissions-in-acl.md)。 + +### 9568434 应用包名不存在 +**错误信息** + +error: Host application is not found. + +**错误描述** + +传入的应用包名不存在。 + +**可能原因** + +应用没有安装。 + +**处理步骤** + +检查传入的应用是否存在。 + +### 9568435 设备不具备插件能力 +**错误信息** + +error: Failed to install the plugin because current device does not support plugin. + +**错误描述** + +当前设备不具备插件能力,导致安装插件失败。 + +**可能原因** + +设备不具备插件能力。 + +**处理步骤** + +使用[param工具](./param-tool.md)设置const.bms.support_plugin的值为true,即执行hdc shell param set const.bms.support_plugin true。 + +### 9568436 多个HSP包信息不一致 +**错误信息** + +error: Failed to install the plugin because they have different configuration information. + +**错误描述** + +多HSP之间的包信息不一致,导致安装失败。 + +**可能原因** + +安装的插件为多HSP时,多个HSP文件的包信息不一致。 + +**处理步骤** + +检查多HSP之间的包信息是否一致,包括[app.json5配置文件](../quick-start/app-configuration-file.md#配置文件标签)中bundleName、bundleType、versionCode、apiReleaseType字段。 + +### 9568437 插件的 pluginDistributionIDs 解析失败 +**错误信息** + +error: Failed to install the plugin because the plugin id failed to be parsed. + +**错误描述** + +插件的 pluginDistributionIDs 解析失败,导致安装失败。 + +**可能原因** + +插件签名信息中的 pluginDistributionIDs 配置不符合规范,导致解析失败。 + +**处理步骤** + +参考如下格式,重新配置插件profile签名文件中的"app-services-capabilities"字段。 +``` +"app-services-capabilities":{ + "ohos.permission.kernel.SUPPORT_PLUGIN":{ + "pluginDistributionIDs":"value-1|value-2|···" + } +} +``` + +### 9568438 插件包名不存在 +**错误信息** + +error: The plugin is not found. + +**错误描述** + +插件不存在。 + +**可能原因** + +当前应用没有安装该插件。 + +**处理步骤** + +使用[bm dump -n 命令](#查询应用信息命令dump)查询应用的信息,检查传入的插件是否安装。 + +### 9568439 插件与应用包名一致 +**错误信息** + +error: The plugin name is same as host bundle name. + +**错误描述** + +插件的包名与应用包名相同。 + +**可能原因** + +插件包名与应用包名一致,导致插件安装失败。 + +**处理步骤** + +重新配置插件的包名。 -- Gitee