l***@163.com
l***@163.com
  • 发布:2025-11-27 11:06
  • 更新:2025-11-27 11:23
  • 阅读:28

uniapp在鸿蒙上架,提示检测到当前软件包user_grant类型的权限与隐私政策中声明的权限不一致

分类:uni-app

隐私托管,需要这么配置权限

2025-11-27 11:06 负责人:无 分享
已邀请:
Ask小助手

Ask小助手

这个问题是由于鸿蒙上架时检测到应用实际请求的user_grant类型权限(如位置、通知等需用户授权的权限)与隐私政策中声明的权限不一致导致的。

解决方案:

  1. 检查应用的实际权限请求:确认代码中调用了哪些requestPermissions权限(特别是user_grant类型)
  2. 核对隐私政策内容:必须在隐私政策中明文说明收集了哪些信息及具体用途,不能仅放置链接
  3. 鸿蒙权限配置:需在/harmony-configs/entry/src/main/module.json5文件的requestPermissions节点中正确声明所有使用的权限
  4. 确保包含DCloud标准声明:隐私政策中必须加入"我们的产品基于DCloud uni-app开发..."的标准描述段落

特别注意:

  • 使用最新版HBuilderX(建议4.85+)重新云打包
  • 检查是否集成了Messaging等可能隐式请求短信权限的模块
  • 华为审核会严格比对实际权限请求与隐私政策声明

参考文档:
鸿蒙权限配置指南
隐私协议自查指南

内容为 AI 生成,仅供参考
l***@163.com

l***@163.com (作者)

/harmony-configs/entry/src/main/module.json5 配置完,打包报错

"requestPermissions": [  
  {  
    "name": "ohos.permission.INTERNET"  
  },  
  {  
    "name": "ohos.permission.SHORT_TERM_WRITE_IMAGEVIDEO"  
  },  
  {  
    "name": "ohos.permission.READ_IMAGEVIDEO"  
  }  
]  

[HBuilder] 11:09:28.615 ​‌​> hvigor WARN: The project has not explicitly set the 'targetSdkVersion' version at build-profile.json5. It is recommended to configure it. Reference: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-hvigor-build-profile-app#section45865492619
[HBuilder] 11:09:28.615 > hvigor ERROR: Failed :entry:default@PreBuild...
[HBuilder] 11:09:28.615 > hvigor ERROR: 00303218 Configuration Error
[HBuilder] 11:09:28.615 Error Message: The reason and usedScene attributes are mandatory for user_grant permissions.
[HBuilder] 11:09:28.615 at D:\code\lxzm\lm-uniapp\unpackage\dist\build\app-harmony\entry\src\main\module.json5
[HBuilder] 11:09:28.615 Try the following:
[HBuilder] 11:09:28.615 > For the hap module, add the reason and usedScene fields to the permission reported in the preceding file.
[HBuilder] 11:09:28.615 > For the har/hsp module, add the reason field to the permission of the error information in the preceding file.
[HBuilder] 11:09:28.615
Try:
[HBuilder] 11:09:28.615 > Run with --stacktrace option to get the stack trace.
[HBuilder] 11:09:28.615 > Run with --debug option to get more log output.
[HBuilder] 11:09:28.615 > hvigor ERROR: BUILD FAILED in 1 s 272 ms
[HBuilder] 11:09:29.132 安装包制作失败

l***@163.com

l***@163.com (作者)

https://bbs.itying.com/topic/68fa84c73b9d2e00410b4301

这里的方法也没生效

要回复问题请先登录注册