From add384916cc36e13b3097232e5f68181528771fa Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Sat, 17 Oct 2026 11:23:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E9=B8=BF=E8=92=99=E5=85=83?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=BA=A6=E5=85=8B=E9=A3=8E=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=A1=A5=E5=85=85=20reason=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ohos.permission.MICROPHONE 是 user_grant 权限,必须同时声明 reason 和 usedScene,缺失导致 hvigor 报 00303218 配置错误、 entry:default@PreBuild 失败。 补充 reason 引用,并新增 permission_microphone_reason 字符串资源。 其余 INTERNET / GET_NETWORK_INFO / VIBRATE 均为 system_grant,无需改动。 --- stub-app-projects/mp-harmony/entry/src/main/module.json5 | 2 ++ .../entry/src/main/resources/base/element/string.json | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/stub-app-projects/mp-harmony/entry/src/main/module.json5 b/stub-app-projects/mp-harmony/entry/src/main/module.json5 index 9d9c47d..c134355 100644 --- a/stub-app-projects/mp-harmony/entry/src/main/module.json5 +++ b/stub-app-projects/mp-harmony/entry/src/main/module.json5 @@ -67,7 +67,9 @@ }, { // PR-FRONTEND-VOICE-INPUT (2026-09-24): 元服务录音需要麦克风权限 + // user_grant 权限必须同时声明 reason 和 usedScene "name": "ohos.permission.MICROPHONE", + "reason": "$string:permission_microphone_reason", "usedScene": { "abilities": [ "EntryAbility" diff --git a/stub-app-projects/mp-harmony/entry/src/main/resources/base/element/string.json b/stub-app-projects/mp-harmony/entry/src/main/resources/base/element/string.json index 9e41945..dec36a0 100644 --- a/stub-app-projects/mp-harmony/entry/src/main/resources/base/element/string.json +++ b/stub-app-projects/mp-harmony/entry/src/main/resources/base/element/string.json @@ -4,6 +4,10 @@ "name": "module_desc", "value": "module description" }, + { + "name": "permission_microphone_reason", + "value": "用于语音搜索与语音输入功能,录制语音以识别用户需求" + }, { "name": "EntryAbility_desc", "value": "EntryAbility description"