鸿蒙Flutter实战:10-常见问题集合
1.flutter 鸿蒙适配指南2.鸿蒙Flutter实战:08-如何调试代码3.鸿蒙Flutter实战:09-现有Flutter项目支持鸿蒙4.鸿蒙Flutter实战:07混合开发5.鸿蒙Flutter实战:02-Windows环境搭建踩坑指南6.鸿蒙Flutter实战:04-如何使用DevTools调试Webview7.鸿蒙Flutter实战:05-使用第三方插件8.鸿蒙Flutter实战:06-使用ArkTs开发Flutter鸿蒙插件9.鸿蒙Flutter实战:01-搭建开发环境10.鸿蒙Flutter实战:03-鸿蒙Flutter开发中集成Webview
11.鸿蒙Flutter实战:10-常见问题集合
12.鸿蒙Flutter实战:11-使用 Flutter SDK 3.22.013.鸿蒙Flutter实战:12-使用模拟器开发调试14.鸿蒙Flutter实战:13-鸿蒙应用打包上架流程15.鸿蒙Flutter实战:14-现有Flutter 项目支持鸿蒙 II鸿蒙Flutter实战:10-常见问题集合
1. 学习路径应该是怎样的,需要掌握哪些技术才具备鸿蒙 Flutter 开发能力
1.1 学习和掌握 Flutter 开发技术,这块需要在Flutter社区学历 Flutter开发文档
1.2 学习鸿蒙基础概念和知识,推荐学习 鸿蒙生态应用开发白皮书, ArkTS 语言, ArkUI,
HarmonyOS 第一课
2. MatePad 应用适配问题
如果出现 app 在 Matepad 上无法全屏的问题,需要在 ohos/entry/main/module.json5中配置设备类型:
"deviceTypes": [
"phone",
"tablet",
"car",
"2in1",
'default'
],
需要增加 tablet
平板设备的适配。
如果在 Matepad 上运行时设备没有全屏,则可以需要删除 App 重装安装或者重启设备。因为相关的配置存在缓存,适配类型发生变化时,存在没有更新的问题,导致无法全屏。
3. 模拟器
模拟器与真机有较大差异,如果出现模拟器异常情况,优先确实真机是否正常运行,以排除模拟器自身问题。
4. debug 版本运行报错
Error while initializing the Dart VM
依次执行以下操作
设置环境变量 export FLUTTER_STORAGE_BASE_URL=https://flutter-ohos.obs.cn-south-1.myhuaweicloud.com
删除 /bin/cache 目录下的缓存
执行 flutter clean,清除项目编译缓存
运行 flutter run -d $DEVICE --debug
5. 如何更换 App 图标和名称
找到 ohos/AppScope/resources/base/media/app_icon.png,替换相应的文件
找到 ohos/AppScope/resources/base/element/string.json 文件,修改以下配置
{
"string": [
{
"name": "app_name",
"value": "中文名称"
}
]
}
6. flutter run 运行 App 报错,提示命令找不到
Launching lib/main.dart on 127.0.0.1:5555
start hap build..-e ERROR: node: /Applications/DevEco-Studio.app/Contents/tools/ohpm/bin/ohpm: line 7: node: commandnot found
-e ERROR: NODE_HOME: /Applications/DevEco-Studio.app/Contents/tools/ohpm/bin/ohpm: line 11: /node:
o such file or directory
-e ERROR: NODE_HOME: /Applications/DevEco-Studio.app/Contents/tools/ohpm/bin/ohpm: line 25: /bin/noc
e: No such file or directory
-e ERROR: Failed to find the executable 'node’ command, please check the following possible causes:e1. Node]s is not installed.e2.'node'command not added to PATH;
eand the 'NoDE HOME' variable is not set in the environment variables to match your NodeJsinstallation location.
ProcessException: The command failedCommand: ohpm clean
检查环境变量配置,配置成功后,检查是否已生效。通过 source ~/.zshrc
或重启命令行程序,甚至重启 IDE/系统,直至变量生效。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
· 为什么 退出登录 或 修改密码 无法使 token 失效