Set up the HarmonyOS SDK
- Go to Preferences > SDKs > HarmonyOS.
- In HarmonyOS SDK location, enter the directory that has the
sdkandbindirectories in it, or select Auto-detect to look for one in the usual places. The label below the field says what was found. - To install the public OpenHarmony SDK into that directory instead, select Download. It covers the compilers, the sysroot, and
hdc, which is what building for a device and reaching one take. Packaging an application still needshvigorfrom Huawei's command-line tools. The archive it comes in is a few gigabytes. - In Additional packages, enter the installation prefix of the third-party libraries built for HarmonyOS, which is the directory their
libis in. Qt Creator passes it to the build asQT_ADDITIONAL_PACKAGES_PREFIX_PATH, which adds the libraries into the package. Without them, the application installs and starts but cannot load the platform plugin. - In Device-hosted SDK, enter the root of an OpenHarmony SDK whose own tools run on a device. Huawei publishes it as
native-ohos-x64, and its payload is for arm64 despite that name. Qt Creator takes a compiler, a CMake, and a sysroot out of it and adds them into its own HarmonyOS package, which is what lets a Qt Creator that runs on a device build there. Leave the field empty for a Qt Creator that only builds on the host. - Keep Create kits automatically selected to have Qt Creator offer a kit for every Qt for HarmonyOS it knows about.
- Building for HarmonyOS needs a Qt that was cross-built for it. The Qt installer publishes one for Qt 6.12 or later, and Install Qt for HarmonyOS installs it. A Qt for HarmonyOS that is there already but unknown to Qt Creator is registered instead.
- Where there is no Qt Online Installer, which is the case for a Qt Creator that runs on a device, the same button downloads the Qt from the repository that Qt repository names. That is the directory an
Updates.xmldescribing the Qt packages is published in, and the newest Qt for HarmonyOS it offers is installed.
Once the SDK location is set, the compilers in it appear in Preferences > Kits > Compilers, and a device that hdc reports appears in Preferences > Devices > Devices, without any further configuration.
That toolchain is around 500 MB of the package it is included in. Configure Qt Creator with -DQTC_HARMONYOS_DEVICE_TOOLCHAIN=OFF to leave it out.
The package does not include the Qt tools, because Qt cannot build them for HarmonyOS yet. A Qt Creator running on a device therefore needs a Qt that was built on that device, registered once in Preferences > Kits > Qt Versions. Qt Creator completes the kit for the device from it.
The scripts/harmonyos/install_sdk.py script in the Qt Creator sources installs the same SDK from the command line, and takes the release and the components to unpack as arguments.
See also Developing for HarmonyOS devices, How to: Develop for HarmonyOS, and Sign HarmonyOS packages.