HarmonyOS鸿蒙Next项目使用Migrate Assistant自动迁移完成后,运行Flutter项目报错

HarmonyOS鸿蒙Next项目使用Migrate Assistant自动迁移完成后,运行Flutter项目报错 项目迁移完成后运行flutter 项目报错

使用 Migrate Assistant 迁移,且工程重新完成同步,并无其他报错提示(迁移成功)。

运行Flutter项目报错,报错信息如下:

Parse ohos module.json5 error: Exception: Can not found module.json5 at /Users/hmw/.pub-cache/git/flutter_packages-0f6bad27408d6d3c7887b9570dd7bad5e12b66cd/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/module.json5 .

You need to update the Flutter plugin project structure.

See https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/docs/09_specifications/update_flutter_plugin_structure.md

Exited (1)


更多关于HarmonyOS鸿蒙Next项目使用Migrate Assistant自动迁移完成后,运行Flutter项目报错的实战教程也可以访问 https://www.itying.com/category-92-b0.html

2 回复

重新编译运行,如果是flutter_flutter 最新的dev分支,就不需要传 --local-engine了
flutter clean
flutter pub get
flutter build hap --local-engine=$ENGINE_DEBUG --debug
flutter run -d $DEVICE --local-engine=$ENGINE_DEBUG --debug

更多关于HarmonyOS鸿蒙Next项目使用Migrate Assistant自动迁移完成后,运行Flutter项目报错的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html


在HarmonyOS鸿蒙Next项目中,使用Migrate Assistant自动迁移后运行Flutter项目报错,可能是由于以下原因:

  1. 依赖冲突:迁移过程中可能引入了不兼容的依赖版本。检查pubspec.yaml文件,确保所有依赖项与鸿蒙系统兼容。

  2. 环境配置问题:确保Flutter SDK和Dart SDK版本与鸿蒙Next兼容。更新到最新稳定版本,并重新配置环境变量。

  3. 迁移不完整:Migrate Assistant可能未完全处理所有文件。手动检查项目结构,确保所有必要文件已正确迁移。

  4. 平台特定代码:鸿蒙Next可能不支持某些Flutter平台特定代码。检查并修改相关代码,确保其兼容性。

建议逐步排查以上问题,或提供具体错误信息以便进一步分析。

回到顶部