HarmonyOS 鸿蒙Next应用调试报错9568289,怎么解决

发布于 1周前 作者 h691938207 最后一次编辑是 5天前 来自 鸿蒙OS

HarmonyOS 鸿蒙Next应用调试报错9568289,怎么解决
<markdown _ngcontent-eqq-c149="" class="markdownPreContainer">

Install Failed: error: failed to install bundle.
code:9568289
error: install failed due to grant request permissions failed.

我只在json5里面声明了权限,还没有实际应用。然后运行就报错了。也不知道哪里权限出问题了。错误也没写第几行

    "extensionAbilities": [
      {
        "name": "EntryBackupAbility",
        "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
        "type": "backup",
        "exported": false,
        "metadata": [
          {
            "name": "ohos.extension.backup",
            "resource": "$profile:backup_config"
          }
        ],
      }
    ],
    "requestPermissions": [
      {
        "name" : "ohos.permission.INTERNET",
        "reason": "$string:permission_internet",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.LOCATION",
        "reason": "$string:permission_location",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.APPROXIMATELY_LOCATION",
        "reason": "$string:permission_location",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.READ_IMAGEVIDEO",
        "reason": "$string:permission_imagevideo",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.WRITE_IMAGEVIDEO",
        "reason": "$string:permission_imagevideo",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.READ_MEDIA",
        "reason": "$string:permission_read_write_media",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.WRITE_MEDIA",
        "reason": "$string:permission_read_write_media",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      },
      {
        "name": "ohos.permission.CAMERA",
        "reason": "$string:permission_camera",
        "usedScene": {
          "abilities": [
            "FormAbility"
          ],
          "when":"inuse"
        }
      }
    ]
2 回复

ohos.permission.WRITE_IMAGEVIDEO、ohos.permission.READ_IMAGEVIDEO是受限权限

该问题是由于默认应用等级为normal,只能使用normal等级的权限,如果使用了system_basic或system_core等级的权限,将导致报错。

对于HarmonyOS应用,请参考使用ACL签名配置指导完成ACL提权。

参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs-V5/faqs-app-debugging-10-V5

HarmonyOS鸿蒙Next应用调试报错9568289,通常是由于权限请求失败引起的。此错误表明项目配置中的权限过高,超出了应用的默认权限等级。

要解决这个问题,你可以尝试以下步骤:

  1. 检查ACL配置:打开HAP包,检查allowed-acls配置,确保申请的权限与应用等级相匹配。如果应用了system_basic或system_core等级的权限,而应用等级为normal,则会导致报错。
  2. 调整权限等级:根据应用需求,调整ACL配置中的权限等级,确保不高于应用等级。
  3. 清理并重新编译工程:清理项目中的旧文件和编译缓存,然后重新编译工程。
  4. 重新安装应用:删除手机或开发板中原有的应用,重新安装编译后的新版本。

如果以上步骤仍无法解决问题,可能是其他配置或代码问题导致的。此时,建议联系官网客服以获取更专业的技术支持。官网地址是:https://www.itying.com/category-93-b0.html

回到顶部