指定 HarmonyOS 部署设置
HarmonyOS 设备通过已签名的 HarmonyOS 能力包(.hap )运行应用程序,因此部署即意味着构建该能力包。请访问Projects >Deploy Settings ,查看Deploy to HarmonyOS device 的操作步骤:
- Build HarmonyOS package (.hap) 收集应用程序所需的资源。它会运行
harmonydeployqt来准备 Qt 库、Qml 导入项和插件,依次添加已准备资源所需的库,并生成 hvigor 项目。 - Package HarmonyOS application with hvigor 将该项目转换为未签名的软件包。
- Sign HarmonyOS package 使用
hap-sign-tool.jar以及来自Preferences >SDKs >HarmonyOS 的素材对其进行签名。 - Install HarmonyOS package with hdc 将其安装到设备上。
在Preferences >SDKs >HarmonyOS 中关闭Run without installing 选项,以便始终重新安装——这是修改后的软件包所必需的。
设备上缺失的库
Qt 依赖于 ICU、fontconfig 、freetype 和libpng ,但 HarmonyOS 设备上均未预装这些库。将Additional packages 设置为这些库的安装前缀,套件会将其作为QT_ADDITIONAL_PACKAGES_PREFIX_PATH 传递给构建过程,从而将其添加到软件包中。当某个库缺失时,Qt Creator 会报告哪个已分阶段的库需要该库。
应用在设备上的名称
配置文件是针对某个特定包名签发的,设备仅会安装该名称下的软件包。因此,Qt Creator 会使用配置文件中的名称而非项目中的名称,当两者不一致时会进行提示。
另请参阅 《如何:构建与运行》、 《如何:为 HarmonyOS 开发》、《为 HarmonyOS 设备开发》、《对 HarmonyOS 包进行签名》以及《在 HarmonyOS 设备上运行》。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.