flutter混合遇到的问题

将ohos文件夹复制到原有flutter项目中运行flutter build hap --target-platform ohos-arm64 --local-engine-src-path=/Users/ohos/flutter/engine/src --local-engine=ohos_release_arm64命令报错,错误信息如下:

install completed in 0s 217ms 
ohpm install success. 
  > hvigor ERROR: The project-level build-profile.json5 file does not comply with the schema. This may occur when the build-profile.json5 file is directly copied from another module, or when the module's hvigorfile requires appTasks 
instead of hapTasks/harTasks. 
Detail: Make sure build-profile.json5 and hvigorfile are configured correctly. 
at /Users/df-flutter/.ohos/flutter_module/hvigorfile.js 
  
  > hvigor ERROR: BUILD FAILED in 1 s 878 ms 
 
error! when invoke: /Users/df-flutter/.ohos/hvigorw clean --mode module -p module=flutter_module@default -p product=default assembleHar --no-daemon ,exitCode = 255. 
assembleHar error! please check log.
HarmonyOS
2024-11-20 08:50:02
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
put_get

​看报错是build-profile.json5不符合规范。请参考链接自行检查下,链接:​https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-hvigor-compilation-options-customizing-sample-0000001778674601-V5#section1448071082016​。

另外需要保证module下面hvigorfile.ts和module.json5文件里的module类型一致。

工程级别对应appTasks,模块级对应如下:

hvigorfile.ts -> harTasks 对应 module.json5 -> module -> type -> har
hvigorfile.ts -> hspTasks 对应 module.json5 -> module -> type -> shared
hvigorfile.ts -> hapTasks 对应 module.json5 -> module -> type -> feature

不同类型的module配置文件需要的配置项不同​。

分享
微博
QQ
微信
回复
2024-11-20 17:48:25
相关问题
请问flutter怎么与HarmonyOS混合开发
200浏览 • 1回复 待解决
HarmonyOS 图文混合问题
418浏览 • 1回复 待解决
应用导航设计遇到问题
526浏览 • 1回复 待解决
DevEco补全问题,有遇到吗?
6479浏览 • 1回复 待解决
HarmonyOS ArrayList 遇到问题
183浏览 • 1回复 待解决
HarmonyOS grid和list混合布局问题
212浏览 • 1回复 待解决
数据持久化遇到各种问题
479浏览 • 1回复 待解决
鸿蒙js开发 video遇到问题
6728浏览 • 1回复 待解决
HarmonyOS ArrayList 遇到问题
313浏览 • 0回复 待解决
HarmonyOS bindPopup遇到问题
200浏览 • 1回复 待解决
HarmonyOS flutter问题
176浏览 • 1回复 待解决
HarmonyOS Flutter插件问题
274浏览 • 1回复 待解决
HarmonyOS引用flutter问题
238浏览 • 1回复 待解决