Version: 1.3
语言 : 中文
OpenHarmony Build Settings
Export an OpenHarmony project

Build your application for OpenHarmony

This page contains instructions on how to build your Tuanjie application for OpenHarmony as well as considerations to be aware of when you do. For information on the build process for OpenHarmony and the tools Tuanjie uses, see How Tuanjie builds OpenHarmony applications.

Instead of building your application, you can also export the Tuanjie project as a hvigor project and import that into Deveco studio. This is useful if you want more control over the build pipeline, want to see or modify the OpenHarmony App Module that Tuanjie generates for your application. For more information, see Exporting an OpenHarmony project.

Some digital distribution services have a limit on the initial install size of your application. Tuanjie includes multiple methods that you can use to optimize the install size. For more information, see Optimize distribution size.

If you want to build your application for debugging purposes, application patching can help you reduce the time it takes to build your application. For more information, refer to Application patching.

Configure the build

Before you create a build, configure your project’s settings so that Tuanjie builds the application with the runtime settings and build system properties you want. There are two sets of settings that configure a Tuanjie build:

Publishing format

Tuanjie can build OpenHarmony applications in the following publishing formats:

  • Hap
  • App

By default, Tuanjie builds OpenHarmony applications in the Hap publishing format.

Build the application

To build your Tuanjie application for OpenHarmony:

  1. Select File > Build Settings.
  2. From the list of platforms in the Platform pane, select OpenHarmony.
    Note: If OpenHarmony is greyed out, set up your project for OpenHarmony development.
  3. Disable Export Project. If you want to export your project for Deveco studio instead of building it within Tuanjie, refer to Exporting your OpenHarmony project.
  4. If you want to use the Build and Run option to immediately run the build on a target device, set Run Device to the device you want to run the application on. For information on how to connect your target device to Tuanjie, refer to Debugging on an OpenHarmony device, depending on the platform you want to build for.
  5. Click either Build or Build and Run.
  6. Select the destination for Tuanjie to place the application. If you selected Build and Run, Tuanjie also installs the application on the Run Device.
  7. Click Save. This starts the build.

Tip: After you specify the output path the first time, you can use Ctrl+B (macOS: Cmd+B) keyboard shortcut to build and run the application.

Application signing

OpenHarmony applications must be digitally signed to run on an OpenHarmony device. There are two types of application signing:

  • Debug signing: The default signing method for a new Tuanjie Project. Applications that use debug signing are able to run on an OpenHarmony device, but you can’t publish them.
  • Custom signing: The signing method that Hvigor uses when you provide custom signing information. Applications that use custom signing are able to run on an OpenHarmony device and you can publish them.

To provide custom signing information, create a keystore and load it into Publishing Settings.

When you provide custom signing information, Tuanjie doesn’t store keystores and key passwords on disk for security reasons. This means that you need to re-enter key passwords each time you restart the Tuanjie Editor. If you don’t provide the passwords and attempt to build the application, the build process fails. To avoid entering passwords each time you open the Tuanjie Editor, it’s best practice to only provide custom signing information when you want to build the application to publish. To create a build for testing on a device, don’t provide custom signing information and use debug signing instead.

For more information about application signing, refer to Sign your hap.

OpenHarmony Build Settings
Export an OpenHarmony project