本页内容

为 HarmonyOS 设备开发

操作指南:为 HarmonyOS 开发

在 HarmonyOS 设备上构建、部署、运行和调试应用程序。

Qt Creator 为 HarmonyOS 设备构建应用程序,将其打包为 HarmonyOS 能力包(.hap ),对包进行签名和安装,并在设备上运行和调试应用程序。

设置 HarmonyOS SDK 的位置,Qt Creator 将据此推导出其余内容:编译器将作为工具链出现,通过hdc 检测已连接的设备,并且 Qt for HarmonyOS 会生成自己的工具包。

所需条件

  • HarmonyOS 命令行工具(6.1 版或更高版本),或已安装的 DevEco Studio。Qt Creator 所指向的目录必须同时包含sdk 和bin 文件。公开的 OpenHarmony SDK 不能替代此要求:它既不包含hvigor ,也不包含签名工具。
  • 适用于 HarmonyOS 的 Qt。Qt Creator 通过其ohos-clang mkspec 来识别它。
  • Java 运行时。SDK 使用hap-sign-tool.jar 对包进行签名,而该工具需要 Java 运行时。
  • Qt 链接的、但设备未自带的第三方库,例如 ICU、fontconfig 、freetype 和libpng ,这些库是为 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.