更新时间:2022-06-03 09:06:56浏览次数:304+次
在安装DevEco Studio 3.0.0.900版本时报有权限错误:Failed due to grant request permissions failed(由于授予请求权限失败而失败),以下是解决方案。
解决方法
需要同时在UnsgnedReleasedProfileTemplate.json(可以从openharmony SDK路径下获取)配置alcs字段,将需要的高等级权限放在acls中如下所示,运行脚本,生成Profile文件。
比如Launcher和Setting应用,apl等级为system_basic,要申请一个安装权限,该权限等级为system_core,则只能通过Profile文件的方式配置,才能够申请成功。
查看申请权限的等级:https://gitee.com/openharmony/resources/blob/master/systemres/main/config.json
然后用命令生成p7b文件:
java -jar hap-sign-tool.jar sign-profile -keyAlias "openharmony application profile release" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "OpenHarmonyProfileRelease.pem" -inFile "UnsgnedReleasedProfileTemplate.json" -keystoreFile "OpenHarmony.p12" -outFile "myApplication_ohos_Provision.p7b" -keyPwd "123456" -keystorePwd "123456"
生成的这个p7b文件替换IDE中build-profile.json5配置的signingConfigs签名中的profile。
处理完成后就不再报Failed due to grant request permissions failed错误了。
相关资讯