HarmonyOS flutter Plugin权限申请报错9568289

在工程中申请了下面的权限,导致 flutter build hap 报错

[Info]App install path:*/ohos/entry/build/default/outputs/default/entry-default-signed.hap, queuesize:0, msg:error: failed to install bundle. code:9568289 error: install failed due to grant request permissions failed.

工程的 module.json5:

{
  "module": {
  "name": "entry",
  "type": "entry",
  "description": "$string:module_desc",
  "mainElement": "EntryAbility",
  "deviceTypes": [
  "phone"
  ],
  "deliveryWithInstall": true,
  "installationFree": false,
  "pages": "$profile:main_pages",
  "abilities": [
  {
    "name": "EntryAbility",
  "srcEntry": "./ets/entryability/EntryAbility.ets",
  "description": "$string:EntryAbility_desc",
  "icon": "$media:icon",
  "label": "$string:EntryAbility_label",
  "startWindowIcon": "$media:icon",
  "startWindowBackground": "$color:start_window_background",
  "exported": true,
  "skills": [
    {
      "entities": [
      "entity.system.home"
      ],
      "actions": [
      "action.system.home"
      ]
    }
    ]
  }
  ],
  "requestPermissions": [
  {"name" :  "ohos.permission.INTERNET"},
  {
    "name" :  "ohos.permission.sec.ACCESS_UDID",
  "usedScene": {"when": "always"}
  }
  ]
}
}

plugins 中的 module.json5

{
  "module": {
  "name": "native_info_ohos",
  "type": "har",
  "deviceTypes": [
  "default",
  "tablet"
  ],
  "requestPermissions": [
  {"name" :  "ohos.permission.INTERNET"},
  {
    "name" :  "ohos.permission.sec.ACCESS_UDID",
  "usedScene": {"when": "always"}
  }
  ]
}
}
HarmonyOS
6天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
aquaa

该问题主要是由于:授予请求权限失败。

开发者可以参考以下步骤,修改HarmonyAppProvision配置文件。

1、打开OpenHarmony SDK所在目录(可通过DevEco Studio菜单栏中单击File > Settings > OpenHarmony SDK界面查看 )。

2、在SDK目录下,进入Toolchains > {Version} > lib文件夹,打开“UnsignedReleasedProfileTemplate.json”文件。

3、修改"apl"为"system_basic",“app-feature"为"hos_system_app”,"allowed-acls"中添加应用module.json5中申请的所有权限

4、File-Project Structure,找到签名配置,先进入签名文件所在路径,删除所有签名文件,然后取消勾选Support HarmonyOs,选择勾选Automatically generate signature,重新生成签名文件,再次安装即可

分享
微博
QQ
微信
回复
6天前
相关问题
HarmonyOS flutter plugin引用时git报错
140浏览 • 1回复 待解决
api 9 申请网络权限报错
3722浏览 • 1回复 待解决
HarmonyOS 安装APP报错code:9568289
1110浏览 • 1回复 待解决
HarmonyOS flutter plugin开发联调问题
133浏览 • 1回复 待解决
HarmonyOS flutter三方plugin适配进展
132浏览 • 1回复 待解决
HarmonyOS 动态申请权限申请不了
111浏览 • 1回复 待解决
HarmonyOS 位置权限申请
108浏览 • 1回复 待解决
HarmonyOS权限申请问题
507浏览 • 1回复 待解决
HarmonyOS 权限申请拒绝问题
171浏览 • 1回复 待解决
HarmonyOS 编译flutter报错
141浏览 • 1回复 待解决
HarmonyOS flutter build报错
129浏览 • 1回复 待解决
HarmonyOS 新增申请权限编译失败
103浏览 • 1回复 待解决
HarmonyOS 申请ACL权限有无模板?
205浏览 • 1回复 待解决
HarmonyOS 申请定位权限失败问题
138浏览 • 1回复 待解决
HarmonyOS SaveButton 申请临时权限失败
483浏览 • 1回复 待解决