使用picker进行照片和视频的选择时,提示没有权限,需要请求权限:ohos.permission.READ\_IMAGEVIDEO,将ohos.permission.READ\_IMAGEVIDEO权限加入到module.json5中时,应用安装不到手机上,提示如下:
Install Failed: error: failed to install bundle.
code:9568289
error: install failed due to grant request permissions failed.
06/28 14:24:22:347: View detailed instructions.
06/28 14:24:22:488: $ hdc shell rm -rf data/local/tmp/a299017a6b1a4b17bcb9fe36f339d93d
Error while Deploy Hap
这时替换当前的debug\_profile为选择了ACL权限的profile,重新编译安装即可安装成功,并能成功通过picker选择图片或视频。
根据报错信息推测是因为用了ACL系统权限,重签名时需使用"apl": “system\_core”, “app-feature”: “hos\_system\_app”, 安装成功后若出现卡在启动页的问题,则执行如下操作即可
1、hdc shell
2、mount -o remount,rw / sed -i “s%/proc/sys/kernel/xpm/xpm\_mode 1%/proc/sys/kernel/xpm/xpm\_mode 0%g” /system/etc/init/key\_enable.cfg
3、重启手机
4、hdc shell “sysctl -w kernel.xpm.xpm\_mode=0”
若非此问题,可参考该文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/restricted-permissions-V5,查询对应权限为何种权限,是否需要acl