HarmonyOS鸿蒙Next中flutter plugin打包产物无法找到
HarmonyOS鸿蒙Next中flutter plugin打包产物无法找到
flutter module项目下的引用的plugin,通过在该plugin下执行 flutter create . --template=plugin --platforms=ohos
添加了鸿蒙平台代码之后在整个module项目通过 flutter build har --local-engine=/xxx/xx/xx/huawei/flutter_engine_debug/src/out/ohos_debug_unopt_arm64 --debug
进行打包,打包成功后,找不到对应plugin生成的har 仍然只能找到 flutter.har
和 flutter_module.har
顺带一提:为什么打包速度这么快,clean之后,我们项目flutter打debug包只要13-16s
更多关于HarmonyOS鸿蒙Next中flutter plugin打包产物无法找到的实战教程也可以访问 https://www.itying.com/category-92-b0.html
使用 flutter_flutter 的 dev 分支(3b52c5d6,2024-05-24 12:10:58)本地验证没有问题,可以正常生成引用的插件 har。
验证步骤:
# 创建 hello_plugin
flutter create -t plugin --platforms=android,ios,ohos hello_plugin
# 创建 hello_module
flutter create -t module hello_module
修改 hello_module/pubspec.yaml
dependencies:
flutter:
sdk: flutter
hello_plugin:
path: ../hello_plugin
webview_flutter:
git:
url: //gitee.com/openharmony-sig/flutter_packages.git
path: packages/webview_flutter/webview_flutter
编译 hello_module 生成 har 包
cd hello_module
flutter build har --local-engine=$ENGINE_DEBUG --debug
生成的 har 文件在 flutter_module/har 目录下
更新 flutter_flutter 的 dev 分支最新代码,安装 readme 重新配置一下环境变量。
建议使用新版本的 DevEco-Studio 或 command-line-tools。配置完成后需要使用 flutter doctor -v 检测一下环境。
https://gitee.com/openharmony-sig/flutter_flutter/tree/dev/
更多关于HarmonyOS鸿蒙Next中flutter plugin打包产物无法找到的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
在HarmonyOS鸿蒙Next中,Flutter插件的打包产物无法找到,可能是由于以下原因导致的:
-
路径问题:检查Flutter插件的输出路径是否正确配置,确保生成的文件位于预期的目录下。
-
构建配置:确认
pubspec.yaml
中是否正确配置了插件的构建选项,特别是flutter
部分的plugin
配置。 -
依赖问题:确保所有依赖项都已正确安装,并且与HarmonyOS SDK兼容。
-
构建工具版本:检查Flutter和HarmonyOS SDK的版本是否兼容,必要时更新到最新版本。
-
构建日志:查看构建日志,定位具体错误信息,根据日志提示进行修复。
建议从以上几个方面逐一排查,确保Flutter插件正确打包并生成所需的产物。