From ae72cde32d6f035d1431d5710cf1b41a409f06f5 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Fri, 12 Jul 2024 11:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=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 --- OAT.xml | 2 ++ ...25\344\275\277\347\224\250PlatformView.md" | 2 +- .../\345\274\200\345\217\221plugin.md" | 2 +- ...71\345\272\223\346\214\207\345\257\274.md" | 2 +- ohos/docs/08_FAQ/environment.md | 17 +++++++++++++- ohos/docs/08_FAQ/ohos_engine.md | 11 +++++----- ohos/docs/08_FAQ/ohos_hap.md | 22 ++++++++++++++++--- .../update_flutter_plugin_structure.md | 4 ++-- 8 files changed, 47 insertions(+), 15 deletions(-) diff --git a/OAT.xml b/OAT.xml index b18f6549..5af15414 100644 --- a/OAT.xml +++ b/OAT.xml @@ -135,9 +135,11 @@ + + diff --git "a/ohos/docs/04_development/\345\246\202\344\275\225\344\275\277\347\224\250PlatformView.md" "b/ohos/docs/04_development/\345\246\202\344\275\225\344\275\277\347\224\250PlatformView.md" index a80593e7..5436a758 100644 --- "a/ohos/docs/04_development/\345\246\202\344\275\225\344\275\277\347\224\250PlatformView.md" +++ "b/ohos/docs/04_development/\345\246\202\344\275\225\344\275\277\347\224\250PlatformView.md" @@ -400,7 +400,7 @@ class CustomViewController { 2,打开 终端,执行下面指令进行编译运行: ```cmd -flutter run -d --local-engine= +flutter run -d ``` diff --git "a/ohos/docs/04_development/\345\274\200\345\217\221plugin.md" "b/ohos/docs/04_development/\345\274\200\345\217\221plugin.md" index 37eb6196..9b001b2c 100644 --- "a/ohos/docs/04_development/\345\274\200\345\217\221plugin.md" +++ "b/ohos/docs/04_development/\345\274\200\345\217\221plugin.md" @@ -64,7 +64,7 @@ environment: ```sh cd hello/example flutter pub get -flutter build hap --local-engine=$ENGINE_DEBUG --debug +flutter build hap --debug ``` #### 2.2 添加 Ohos 平台代码 (.ets) diff --git "a/ohos/docs/07_plugin/OHOS\345\271\263\345\217\260\351\200\202\351\205\215flutter\344\270\211\346\226\271\345\272\223\346\214\207\345\257\274.md" "b/ohos/docs/07_plugin/OHOS\345\271\263\345\217\260\351\200\202\351\205\215flutter\344\270\211\346\226\271\345\272\223\346\214\207\345\257\274.md" index a5d241d2..3cb42348 100644 --- "a/ohos/docs/07_plugin/OHOS\345\271\263\345\217\260\351\200\202\351\205\215flutter\344\270\211\346\226\271\345\272\223\346\214\207\345\257\274.md" +++ "b/ohos/docs/07_plugin/OHOS\345\271\263\345\217\260\351\200\202\351\205\215flutter\344\270\211\346\226\271\345\272\223\346\214\207\345\257\274.md" @@ -322,7 +322,7 @@ cd到`path_provider_ohos\example > ohos`目录,使用下列指令运行: `flutter pub get` -`flutter run -d --local-engine=` +`flutter run -d ` **运行成功效果如下:** diff --git a/ohos/docs/08_FAQ/environment.md b/ohos/docs/08_FAQ/environment.md index 987d0194..7cd500c3 100644 --- a/ohos/docs/08_FAQ/environment.md +++ b/ohos/docs/08_FAQ/environment.md @@ -77,4 +77,19 @@ strict_ssl=false # 设置代理 # http_proxy=http://user:password@host:8080 # https_proxy=http://user:password@host:8080 -``` \ No newline at end of file +``` + +## 模拟器运行默认计数器应用闪退 + +问题分析: + +- FloatingActionButton 在模拟器上不支持,需要在 lib/main.dart 中注释 FloatingActionButton 后再运行到模拟器上。 +- [模拟器与真机的差异](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-emulator-specification-0000001839876358-V5) + +## [ios][release] GeneratedPluginRegistrant.m Module not found + +问题分析:pubspec.yaml 中新增了flutter插件,但是 Podfile 中没有新增插件相关的pod引用。 + +解决方案:`rm ios/podfile && flutter clean && flutter run -d ` + +参考链接:[GeneratedPluginRegistrant.m Module not found](https://github.com/flutter/flutter/issues/43986) \ No newline at end of file diff --git a/ohos/docs/08_FAQ/ohos_engine.md b/ohos/docs/08_FAQ/ohos_engine.md index 3097546d..a594150e 100644 --- a/ohos/docs/08_FAQ/ohos_engine.md +++ b/ohos/docs/08_FAQ/ohos_engine.md @@ -4,12 +4,11 @@ flutter_engine环境编译配置参考 https://gitee.com/openharmony-sig/flutter ## flutter鸿蒙化引擎编译环境推荐配置版本 -1. python3.8 - python3.11 -2. java17 -3. node18 -4. ohpm1.6+ -5. HamonyOS SDK api11 -6. Xcode14.3 +1. python 3.8-3.11, 3.12版本会出现报错。 +2. java 17 +3. DevEco-Studio / command-line-tools , 5.0.3.300+ + 1. 包含了 ohpm, hvigorw, node, HarmonyOS SDK +4. Xcode14.3 ## 如何生成flutter.har diff --git a/ohos/docs/08_FAQ/ohos_hap.md b/ohos/docs/08_FAQ/ohos_hap.md index 565bfba9..8365569d 100644 --- a/ohos/docs/08_FAQ/ohos_hap.md +++ b/ohos/docs/08_FAQ/ohos_hap.md @@ -9,6 +9,7 @@ - mac, 修改 `~/.bash_profile`, 并在 `~/.zshrc` 中加上 `source ~/.bash_profile` ```sh +# --local-engine 参数可选,指向自行编译的engine产物,建议在 linux/mac 环境使用 export ENGINE_DIR=~/ohos/engine export ENGINE_DEBUG=$ENGINE_DIR/src/out/ohos_debug_unopt_arm64 export ENGINE_PROFILE=$ENGINE_DIR/src/out/ohos_profile_arm64 @@ -53,9 +54,9 @@ LastFatalMessage:Thread:547846269584[FATAL:flutter/runtime/dart_vm_initializer.c 运行或编译命令中,使用的engine产物和运行模式需要保持一致。 参考命令: ```sh -flutter run -d --local-engine=/Users/xxx/ohos/src/out/ohos_debug_unopt_arm64 --debug -flutter run -d --local-engine=/Users/xxx/ohos/src/out/ohos_release_arm64 --release -flutter run -d --local-engine=/Users/xxx/ohos/src/out/ohos_profile_arm64 --profile +flutter run -d --debug +flutter run -d --release +flutter run -d --profile ``` ## 应用编译报错,flutter插件结构重构前的版本使用了重构后的插件库 @@ -100,3 +101,18 @@ dependency_overrides: url: https://gitee.com/openharmony-sig/flutter_packages.git path: packages/path_provider/path_provider_ohos ``` + +## The SDK license agreement is not accepted + +日志信息: + +```log +hvigor install success. +> hvigor ERROR: Cause: The SDK license agreement is not accepted. +``` + +问题分析:ohos工程的结构还是api11的,但是使用的sdk是api12的,这种情况下就会出现这个报错信息。 +解决方案:将ohos工程结构升级为api12。 +操作步骤: +1. DevEco-Studio -> Migrate Assistant -> 5.0.0 -> Migrate +2. DevEco-Studio -> File -> Project Structure -> Compatible SDK -> 5.0.0(12) diff --git a/ohos/docs/09_specifications/update_flutter_plugin_structure.md b/ohos/docs/09_specifications/update_flutter_plugin_structure.md index 3d69248c..dfef47c7 100644 --- a/ohos/docs/09_specifications/update_flutter_plugin_structure.md +++ b/ohos/docs/09_specifications/update_flutter_plugin_structure.md @@ -19,7 +19,7 @@ rm -rf ohos mv ohos2 ohos cd example flutter pub get -flutter build hap --local-engine=$ENGINE_DEBUG --debug +flutter build hap --debug ``` 执行`flutter run`后会出现报错,需要修改配置文件中的name字段,还需要修改 hvigorfile.ts。 @@ -122,7 +122,7 @@ export { harTasks } from '@ohos/hvigor-ohos-plugin'; ``` cd integration_test/example -flutter run -d $DEVICE --local-engine=$ENGINE_DEBUG --debug +flutter run -d $DEVICE --debug ``` ### 运行鸿蒙应用时,需要注意配置文件中 har文件 的引用 -- Gitee