恒美微站 Logo 恒美微站
  • 首页
  • 关于我们
  • 建站服务
  • 主题模板
  • 案例展示
  • 资讯中心
  • 联系我们

Flutter OHOS 更新Flutter插件项目结构

  • 首页
  • 资讯中心
  • /
  • Flutter OHOS 更新Flutter插件项目结构

相关资讯

基于uniapp与Spring Boot的房产中介微信小程序开发实战 2026/9/9 16:19:11
SQL注入原理与防御实战:从绕过技巧到参数化查询加固 2026/9/9 16:19:11
代码化图表设计实战:从工具选型到画出清晰架构图 2026/9/9 16:19:11

最新资讯

拆解莱丹热风枪:昂贵背后的工业级设计秘密
梯度下降从入门到工程调试:原理、迭代流程与常见坑
梯度下降详解:从数学原理到Python手写实现与可视化
梯度下降原理与Python实现:从公式到动画演示全流程解析
Agent Lightning 自动提示优化实战指南:三步把提示词调优交给 APO
Sunshine游戏串流主机5分钟上手完整指南

今日推荐

基于MongoDB的图书管理系统:数据建模与Spring Boot+Vue实战
Claude Code安装配置全攻略:从零开始用上终端AI编程助手
tmux 会话管理与终端复用:AI 编程工作流的调度中枢实战

本周热门

超人会飞不算本事:系统稳定依赖清晰规则与边界设计
超人VS蜘蛛侠:拆解超级IP的影响力与传播方法论
基于CNN的调制信号识别:MATLAB实现时频图分类实战

本月精选

自研推理加速器Redwood:两周内实现PyTorch模型高效部署的实战教程
V4L2摄像头采集实战:从camera_client.rar到出图全流程解析
从“谁发明了钢琴键”到知识问答智能体:RAG与记忆工程实践

Flutter OHOS 更新Flutter插件项目结构

发布时间:2026/9/9 16:19:11
Flutter OHOS 更新Flutter插件项目结构 更新内容flutter插件项目中的ohos目录将从OpenHarmony工程project结构替换为OpenHarmony工程module结构。flutter工程中引用的har文件统一放到 ohos/har 目录下。更新后需要删除ohos插件中的旧模块目录。更新步骤以flutter_flutter中的 integration_test 为例的更新步骤如下:1. integration_test/ohos 目录由 project 结构修改为 module 结构 注意以下命令默认在类 Unix 环境Linux/macOS下运行。Windows 用户请使用 WSL 或自行适配 PowerShell 命令。cdflutter_flutter/packages/integration_testmvohos/ohos ./ohos2rm-rfohosmvohos2 ohoscdexample flutter pub get flutter build hap--debug执行flutter run后会出现报错需要修改配置文件中的name字段还需要修改 hvigorfile.ts。2. 代码更新2.1 修改 integration_test/ohos/oh-package.json5修改前{name:ohos,version:1.0.0,description:Please describe the basic information.,main:,author:,license:,dependencies: { },devDependencies: {ohos/hypium:1.0.11} }修改后{name:integration_test,//和插件名(pubspec.yaml中的name)保持一致version:1.0.0,description:Please describe the basic information.,main:,author:,license:Apache-2.0,dependencies: {ohos/flutter_ohos:file:har/flutter.har, } }2.2 修改 integration_test/ohos/src/main/module.json5修改前{module: {name:ohos,type:har,deviceTypes: [default,tablet,2in1] } }修改后{module: {name:integration_test,//和插件名(pubspec.yaml中的name)保持一致type:har,deviceTypes: [default,tablet,2in1] } }2.3 修改 integration_test/ohos/hvigorfile.ts修改前import{ appTasks }fromohos/hvigor-ohos-plugin; exportdefault{system: appTasks,/* Built-in plugin of Hvigor. It cannot be modified. */plugins:[]/* Custom plugin to extend the functionality of Hvigor. */}修改后export{ harTasks }fromohos/hvigor-ohos-plugin;检查是否可以正常运行使用 DevEco-Studio 打开 integration_test/example, 配置签名。使用命令运行example。cdintegration_test/example flutter run -d$DEVICE--debug运行OpenHarmony应用时需要注意配置文件中 har文件 的引用引用的har文件在 ohos/har 目录下。integration_test/example/ohos/oh-package.json5修改后{//...dependencies: {ohos/flutter_ohos:file:./har/flutter.har},overrides: {ohos/flutter_ohos:file:./har/flutter.har} }integration_test/example/ohos/entry/oh-package.json5修改前{//...dependencies: {ohos/integration_test:file:./har/integration_test.har, } }修改后{//...dependencies: {integration_test:file:../har/integration_test.har, } }可能遇到的问题1. no such file or directory日志信息hvigorERROR:ENOENT: no such file or directory, statxxx/flutter_flutter/packages/integration_test/ohos/build/default/cache/default/defaultpackageHar/ohos/oh_modules/ohos/flutter_ohos解决方案手动删除报错信息提示的文件。2. operation not permitted, symlink日志信息hvigorERROR:ENOENT: operation not permitted, symlinkxxx/webview_flutter_ohos/ohos/webview_flutter/oh_modules/.ohpm/ohosflutter_ohosfilelibsflutter.har/oh_modules/ohos/flutter_ohos -xxx/webview_flutter_ohos/ohos/build/default/cache/default/defaultPackageHar/webview_flutter/oh_modules/ohos/flutter_ohos解决方案har结构整改前的部分目录在更新代码后需要手动删除例如flutter_packages/packages/webview_flutter_ohos/ohos/webview_flutterflutter_packages/packages/path_provider_ohos/ohos/path_providerflutter_packages/packages/file_selector_ohos/ohos/FileSelector

关于恒美微站

恒美微站专注于为个体商户、工作室提供极简自助建站服务,让每个人都能轻松拥有专业网站。

快速链接

  • 关于我们
  • 建站服务
  • 主题模板
  • 案例展示
  • 资讯中心

服务项目

  • 可视化建站
  • 拖拽编辑
  • 主题定制
  • SEO 优化
  • 网站托管

联系方式

  • 📍 地址:北京市朝阳区建国路 88 号
  • 📞 电话:400-888-8888
  • ✉️ 邮箱:info@hmyw.cn
  • 🕐 时间:周一至周日 9:00-18:00

© 2024 恒美微站 hmyw.cn 版权所有 | 京 ICP 备 12345678 号