Developing for HarmonyOS devices

How to: Develop for HarmonyOS

Build, deploy, run, and debug applications on HarmonyOS devices.

Qt Creator builds applications for HarmonyOS devices, packages them as a HarmonyOS Ability Package (.hap), signs and installs the package, and runs and debugs the application on the device.

Set the location of the HarmonyOS SDK, and Qt Creator derives the rest from it: the compilers appear as toolchains, connected devices are detected over hdc, and a Qt for HarmonyOS produces a kit of its own.

What you need

  • The HarmonyOS command-line tools, version 6.1 or newer, or an installation of DevEco Studio. The directory to point Qt Creator at is the one that has both sdk and bin in it. The public OpenHarmony SDK is not a substitute: it carries no hvigor, which packaging an application needs.
  • A Qt for HarmonyOS. Qt Online Installer and Qt Maintenance Tool offer one as qt.qt6.<version>.harmonyos_arm64_v8a, from Qt 6.12 on. Qt Creator recognizes it by its ohos-clang mkspec. For a Qt from a development branch, or for modules the package leaves out, the scripts/harmonyos/build_qt.py script in the Qt Creator sources cross-builds one.
  • A Java runtime. The SDK signs the package with hap-sign-tool.jar, which needs one.
  • The third-party libraries Qt links against that the device does not carry, such as ICU, fontconfig, freetype, and libpng, built for HarmonyOS and installed under one prefix. The installed package carries none of them, so it needs them as much as a Qt built here does. The scripts/harmonyos/install_third_party.py script in the Qt Creator sources builds them with vcpkg.
  • Signing material issued for a developer account: a certificate, a provisioning profile, a keystore, and the key alias. A provisioning profile is issued for one bundle name and, for debugging, for particular devices. The device installs a package only under the bundle name of the profile it was signed with.
  • A device with wireless debugging turned on, paired with the computer.

See also How to: Develop for HarmonyOS and How to: Manage kits.