HarmonyOS 鸿蒙Next安装HAP时提示失败
HarmonyOS 鸿蒙Next安装HAP时提示失败
报错提示:Install Failed: error: failed to install bundle.
code:9568289
error: install failed due to grant request permissions failed.
View detailed instructions.
$ hdc shell rm -rf data/local/tmp
Launch com.jd.oa.hm failed, starting handle failure progress
Error while Deploy Hap
code:9568289
error: install failed due to grant request permissions failed.
View detailed instructions.
$ hdc shell rm -rf data/local/tmp
Launch com.jd.oa.hm failed, starting handle failure progress
Error while Deploy Hap
2 回复
READ_IMAGEVIDEO 和 WRITE_IMAGEVIDEO 为受限权限 对于用户权限 您申请ACL白名单成功之后需要进行如下配置 以ohos.permission.WRITE_IMAGEVIDEO权限为例 其权限级别为system_basic 一. 在应用配置文件中添加申请的权限 应用module.json5 文件中,声明需要申请的权限
{ "module" : { "requestPermissions": [ { "name": "ohos.permission.WRITE_IMAGEVIDEO", } ] } }
二.修改SDK配置文件 修改SDK文件:OH SDK\toolchains\lib UnsgnedReleasedProfileTemplate.json 主要修改apl、app-feature、allowed-acls这三个字段
“bundle-info”: { “developer-id”: “OpenHarmony”, “development-certificate”: “xxxx”, “bundle-name”: “com.OpenHarmony.app.test”, “apl”: “system_basic”, //权限级别 “app-feature”: “hos_system_app” //更改为hos_system_app, 即系统APP }, “acls”: { “allowed-acls”: [ “ohos.permission.WRITE_IMAGEVIDEO” //需要申请的权限,与第一步声明的权限对应 ] },
三.使用DevEco Studio 重新生成签名 修改完成后,重启DevEco Studio 打开File->Project Structure ->SingningConfigs 勾选Automatically generate signature,会自动重新生成权限,此时重新编译应用,就会具有系统权限
受限权限查看请访问链接受限开放权限-应用权限列表-应用权限管控-程序访问控制-安全-系统 - 华为HarmonyOS开发者 (huawei.com)