From c6fbac2bf2469f9e132460562edee2a4304085bd Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Fri, 9 Aug 2024 19:24:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ohos=E8=B0=83=E7=94=A8=E7=9A=84hvigorw?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=91=BD=E4=BB=A4=E5=A2=9E=E5=8A=A0buildMode?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- packages/flutter_tools/lib/src/ohos/hvigor.dart | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/ohos/hvigor.dart b/packages/flutter_tools/lib/src/ohos/hvigor.dart index 81e25f8eab..cd59457d29 100644 --- a/packages/flutter_tools/lib/src/ohos/hvigor.dart +++ b/packages/flutter_tools/lib/src/ohos/hvigor.dart @@ -148,6 +148,7 @@ Future assembleHap( required String ohosRootPath, required String hvigorwPath, required String flavor, + required String buildMode, Logger? logger}) async { final List command = [ hvigorwPath, @@ -155,6 +156,8 @@ Future assembleHap( 'assembleHap', '-p', 'product=$flavor', + '-p', + 'buildMode=$buildMode', '--no-daemon', ]; return hvigorwTask(command, @@ -169,6 +172,7 @@ Future assembleApp( required String ohosRootPath, required String hvigorwPath, required String flavor, + required String buildMode, Logger? logger}) async { final List command = [ hvigorwPath, @@ -176,6 +180,8 @@ Future assembleApp( 'assembleApp', '-p', 'product=$flavor', + '-p', + 'buildMode=$buildMode', '--no-daemon', ]; return hvigorwTask(command, @@ -190,6 +196,8 @@ Future assembleHar( required String workPath, required String hvigorwPath, required String moduleName, + required String buildMode, + String product = 'default', Logger? logger}) async { final List command = [ hvigorwPath, @@ -199,7 +207,7 @@ Future assembleHar( '-p', 'module=$moduleName', '-p', - 'product=default', + 'product=$product', 'assembleHar', '--no-daemon', ]; @@ -216,6 +224,7 @@ Future assembleHsp( required String hvigorwPath, required String moduleName, required String flavor, + required String buildMode, Logger? logger}) async { final List command = [ hvigorwPath, @@ -226,6 +235,8 @@ Future assembleHsp( 'module=$moduleName', '-p', 'product=$flavor', + '-p', + 'buildMode=$buildMode', 'assembleHsp', '--no-daemon', ]; @@ -477,6 +488,7 @@ class OhosHvigorBuilder implements OhosBuilder { hvigorwPath: hvigorwPath, flavor: getFlavor( _ohosProject.getBuildProfileFile(), ohosBuildInfo.buildInfo.flavor), + buildMode: ohosBuildInfo.buildInfo.modeName, logger: _logger); status.stop(); if (errorCode != 0) { @@ -620,6 +632,7 @@ class OhosHvigorBuilder implements OhosBuilder { flavor: getFlavor( _ohosProject.getBuildProfileFile(), ohosBuildInfo.buildInfo.flavor), hvigorwPath: hvigorwPath, + buildMode: ohosBuildInfo.buildInfo.modeName, logger: _logger); status.stop(); if (errorCode1 != 0) { @@ -706,6 +719,7 @@ class OhosHvigorBuilder implements OhosBuilder { workPath: ohosProjectPath, moduleName: moduleName, hvigorwPath: hvigorwPath, + buildMode: ohosBuildInfo.buildInfo.modeName, logger: logger); if (errorCode != 0) { throwToolExit('Oops! assembleHars failed! please check log.'); @@ -753,6 +767,7 @@ class OhosHvigorBuilder implements OhosBuilder { hvigorwPath: hvigorwPath, flavor: getFlavor( project.ohos.getBuildProfileFile(), ohosBuildInfo.buildInfo.flavor), + buildMode: ohosBuildInfo.buildInfo.modeName, logger: logger); if (errorCode != 0) { throwToolExit('Oops! assembleHsps failed! please check log.'); -- Gitee From 57065693ffe1a082b01cd0cc1bb849cdd87863a9 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Fri, 9 Aug 2024 19:56:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0readme=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- README.en.md | 28 ++++++++++++++++++++++++++-- README.md | 28 ++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/README.en.md b/README.en.md index 87a9d2cc92..de839b0634 100644 --- a/README.en.md +++ b/README.en.md @@ -166,5 +166,29 @@ Attachment: [Flutter third-party library adaptation plan](https://docs.qq.com/sh 3. Execute `flutter run -d $DEVICE --debug` 3. Additional information: If a similar error occurs while running Android or iOS, you can also try restoring the environment variable FLUTTER_STORAGE_BASE_URL , clearing the cache, and then running again. -12. After the ROM update in Beta 2 version, anonymous memory requests are no longer supported. - 1. Reference Documents: [Explanation of Change in Anonymous Memory Execution Permission Control Policy](https://developer.huawei.com/consumer/cn/doc/harmonyos-roadmap-V5/changelogs-for-all-apps-b031-V5#%E5%8C%BF%E5%90%8D%E5%86%85%E5%AD%98%E6%89%A7%E8%A1%8C%E6%9D%83%E9%99%90%E7%AE%A1%E6%8E%A7%E7%AD%96%E7%95%A5%E5%8F%98%E6%9B%B4%E8%AF%B4%E6%98%8E) +12. After the ROM update of Beta 2 version, it no longer supports requesting anonymous memory with execution permission, resulting in debug crashing. + 1. Solution: Update flutter_flutter to a version after a44b8a6d (2024-07-25). + 2. Key logs: + + ``` + #20 at attachToNative (oh_modules/.ohpm/@ohos+flutter_ohos@g8zhdaqwu8gotysbmqcstpfpcpy=/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterNapi.ets:78:32) + #21 at attachToNapi (oh_modules/.ohpm/@ohos+flutter_ohos@g8zhdaqwu8gotysbmqcstpfpcpy=/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngine.ets:144:5) + #22 at init (oh_modules/.ohpm/@ohos+flutter_ohos@g8zhdaqwu8gotysbmqcstpfpcpy=/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngine.ets:133:7) + ``` + +13. DevEco-Studio(5.0.3.600 Beta3),windows版本编译flutter应用报错 + 1. Solution: Update flutter_flutter to a version after c6fbac2b (2024-08-09). + 2. Key logs: + + ``` + hvigor ERROR: Schema validate failed. + Detail: Please check the following fields. + { + instancePath: 'modules[2].srcPath', + keyword: 'pattern', + params: { pattern: '^(\\./|\\.\\./)[\\s\\S]+$' }, + message: 'must match pattern "^(\\./|\\.\\./)[\\s\\S]+$"', + } + ``` + +[More FAQ](https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/README.md) diff --git a/README.md b/README.md index 6979fba390..4807cfb3dd 100644 --- a/README.md +++ b/README.md @@ -180,5 +180,29 @@ Flutter SDK 仓库 4. 运行 `flutter run -d $DEVICE --debug` 3. 补充信息: 运行android或ios出现类似错误,也可以尝试还原环境变量 FLUTTER_STORAGE_BASE_URL ,清除缓存后重新运行。 -11. Beta2版本的ROM更新后,不再支持申请匿名内存。 - 1. 参考文档:[匿名内存执行权限管控策略变更说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-roadmap-V5/changelogs-for-all-apps-b031-V5#%E5%8C%BF%E5%90%8D%E5%86%85%E5%AD%98%E6%89%A7%E8%A1%8C%E6%9D%83%E9%99%90%E7%AE%A1%E6%8E%A7%E7%AD%96%E7%95%A5%E5%8F%98%E6%9B%B4%E8%AF%B4%E6%98%8E) +11. Beta2版本的ROM更新后,不再支持申请有执行权限的匿名内存,导致debug运行闪退。 + 1. 解决方案:更新 flutter_flutter 到 a44b8a6d (2024-07-25) 之后的版本。 + 2. 关键日志: + + ``` + #20 at attachToNative (oh_modules/.ohpm/@ohos+flutter_ohos@g8zhdaqwu8gotysbmqcstpfpcpy=/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterNapi.ets:78:32) + #21 at attachToNapi (oh_modules/.ohpm/@ohos+flutter_ohos@g8zhdaqwu8gotysbmqcstpfpcpy=/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngine.ets:144:5) + #22 at init (oh_modules/.ohpm/@ohos+flutter_ohos@g8zhdaqwu8gotysbmqcstpfpcpy=/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngine.ets:133:7) + ``` + +12. DevEco-Studio(5.0.3.600 Beta3),windows版本编译flutter应用报错 + 1. 解决方案:更新 flutter_flutter 到 c6fbac2b (2024-08-09) 之后的版本。 + 2. 关键日志: + + ``` + hvigor ERROR: Schema validate failed. + Detail: Please check the following fields. + { + instancePath: 'modules[2].srcPath', + keyword: 'pattern', + params: { pattern: '^(\\./|\\.\\./)[\\s\\S]+$' }, + message: 'must match pattern "^(\\./|\\.\\./)[\\s\\S]+$"', + } + ``` + +[更多FAQ](https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/README.md) -- Gitee