目录

Signing Your App/Service Automatically

Function Description

Automatic signing for HarmonyOS app debugging is categorized into two types: signing for an app associated with a registered app and signing for an app not associated with a registered app.

Constraints

Signing for HarmonyOS Projects

[h2]Automatic Signing for an App Associated with a Registered App

  1. Connect to a local real device or an emulator, or register a debug device with AppGallery Connect, and start signing.
    • Since version 26.0.0, signing can start after a device is registered with AppGallery Connect.
    • If multiple devices are connected simultaneously, information of all these devices will be written to the certificate file during automatic signing.
  2. Choose File > Project Structure... > Project > Signing Configs and select Associate with registered application. If you have not signed in, click Sign In first.
    • You can select a team account from the Team drop-down list to switch accounts.
    • DevEco Studio searches for apps under the current team in AppGallery Connect that match the bundle name. If a matching app is found in AppGallery Connect, automatic signing proceeds. If no app is found or conflicts are detected, follow the on-screen instructions to make modifications and retry automatic signing. For details, see FAQs.
  3. Click Enable open capabilities to manage the integrated open capabilities. The access modes for open capabilities include default enablement, direct enablement, and request-based enablement. For details about the supported open capabilities, see Open Capabilities Supported by Automatic Signing.
    • Default enablement: Open capabilities of this type are checked by default, including Account Kit, Location Kit, and Intents Kit.
    • Direct enablement: Click the name of an open capability, view the function description on the right, and check the option to enable it.
    • Request-based enablement: Click the name of an open capability to view the function description on the right. Fill in the request reason and upload attachments. Submitted requests can be viewed on the interaction center page in AppGallery Connect. For details, see Managing Huawei Open Capabilities.

    The Push Kit open capability cannot be revoked after access.

  4. (Optional) Add the ACL permission information. For details about ACL permissions, see ACL Permissions Supported by Automatic Signing.
    26.0.0 Beta2 or later
    1. Click Enable ACL Permissions to access the ACL permission configuration page, and click to add ACL permissions for the module. The added permissions will be synchronized to the module.json5 file of the module, and the permission information added to the module.json5 file will also be synchronized to the ACL permission configuration page.

    2. Select an ACL permission name, click , select the applicable module (Module), enter the request reason (Reason), select the invoking time (When) and abilities, and click OK. In addition, you can click the edit or delete button to modify or remove existing ACL permission configurations.

    3. Enter the request reason for all ACL permissions (Request reason) and upload attachments (Attachment), and click OK to submit the request.

    4. After submission, you can view the ACL permission request progress on the interaction center page in AppGallery Connect. Alternatively, click Enable ACL Permissions to go to the permission request page and filter to view the request status.

    Versions earlier than 26.0.0

    To declare required permissions, add the requestPermissions field in your module's module.json5 file. Here is an example for adding the ohos.permission.ACCESS_DDK_USB permission to a stage model project:
    {
      "module": {
        "requestPermissions": [{
          "name": "ohos.permission.ACCESS_DDK_USB",
        }],
      }
    }

    • Precautions:
      • Restricted permissions are granted only in special scenarios. Make sure that your use case is among those scenarios before requesting the restricted permissions. For details about how to request these permissions, see Requesting Restricted Permissions.
      • When submitted for release, apps involving restricted permissions will be reviewed by AppGallery Connect based on the app's use case to determine whether they can use the corresponding restricted permissions. If the requirements are not met, the app will be rejected. For details about the review process, see Releasing a HarmonyOS App.
    • Profile certificate description:
      • A temporary profile certificate with a short validity period can be obtained after an ACL permission request is submitted, but before it is approved. This allows the app to be signed. If the request is still not approved when the temporary certificate expires, a new temporary certificate must be requested and acquired again for signing.
      • Once the ACL permission request is approved, an official profile certificate with a longer validity period can be acquired.
  5. After the signing is complete, the keystore file (.p12), certificate signing request (CSR) with the .csr extension, digital certificate (.cer), and profile (.p7b) are generated locally. Hover over next to Provisioning Profile: DevEco Managed Profile to view details such as the certificate validity period, bundle name, ACL permissions, and open capabilities. Alternatively, open the project-level build-profile.json5 file and view the signature information in signingConfigs.

[h2]Automatic Signing for an App Not Associated with a Registered App

  1. Connect to a local real device or an emulator, or register a debug device with AppGallery Connect, and start signing.

    • Since version 26.0.0, signing can start after a device is registered with AppGallery Connect.
    • If multiple devices are connected simultaneously, information of all these devices will be written to the certificate file during automatic signing.

  2. (Optional) Add the ACL permission information to the configuration file. For details about ACL permissions, see ACL Permissions Supported by Automatic Signing.

    To declare required permissions, add the requestPermissions or reqPermissions field in your module's module.json5 (stage model) or config.json (FA model) file. Here is an example for adding the ohos.permission.ACCESS_DDK_USB permission to a stage model project:
    {
      "module": {
        "requestPermissions": [{
          "name": "ohos.permission.ACCESS_DDK_USB",
        }],
      }
    }

    • Validation is not forcibly applied to the ACL permissions added in the configuration file during debug signing.
    • When submitted for release, apps involving restricted permissions will be reviewed by AppGallery Connect based on their use cases to determine whether they can use the corresponding restricted permissions. If an app fails to meet the requirements, its release request will be rejected. Before configuring ACL permissions, ensure that your app's use case aligns with the scenarios for which restricted permissions are granted. Currently, only a limited number of apps qualifying for specific scenarios may use restricted permissions after approval. For details on how to request, see Requesting Restricted Permissions.

  3. Choose File > Project Structure... > Project > Signing Configs, select Automatically generate signature, and then click OK. When prompted, click Sign In to log in. Then the system will automatically sign your app/service.

  4. After the signing is complete, the keystore file (.p12), CSR (.csr), digital certificate (.cer), and profile (.p7b) are generated locally. Hover over next to Provisioning Profile: DevEco Managed Profile to view details such as the certificate validity period, bundle name, ACL permissions, and open capabilities. Alternatively, open the project-level build-profile.json5 file and view the signature information in signingConfigs.

(Optional) Signing an OpenHarmony Project

  • You are advised to use the HarmonyOS signature when signing an OpenHarmony project. This is because the OpenHarmony signature is a release signature, and apps signed with a release signature do not support debugging features such as debug log printing. Additionally, using the OpenHarmony signature may affect app running.
  • If multiple devices are connected simultaneously, information of all these devices will be written to the certificate file during automatic signing.
  1. Connect to a local real device or an emulator, or register a debug device with AppGallery Connect, and start signing. Since version 26.0.0, signing can start after a device is registered with AppGallery Connect.
  2. Choose File > Project Structure... > Project > Signing Configs. If only Automatically generate signature is selected, an OpenHarmony signature is generated. If both Support HarmonyOS and Automatically generate signature are selected, a HarmonyOS signature is generated. (If you have not signed in, click Sign In first.)

    After the signing is complete, the page shown below is displayed. The keystore file (.p12), CSR (.csr), digital certificate (.cer), and profile (.p7b) are generated locally. You can view the digital certificate on the Certificates, App IDs, and Profiles tab of AppGallery Connect.

Appendix

[h2]ACL Permissions Supported by Automatic Signing

The following lists the ACL permissions supported by automatic signing. Once automatic signing is enabled, DevEco Studio verifies that all declared ACL permissions are included in the following list. If validated, it automatically requests the corresponding profile from AppGallery Connect for signing and packaging, eliminating cumbersome manual steps.

In DevEco Studio 6.1.0 Beta2 and later versions, automatic signing supports the ACL permissions listed in Restricted Permissions.

6.0.2 Beta1

New permissions

6.0.1 Release (6.0.1.260)

New permissions

6.0.0 Beta3

New permissions

5.1.0 Release

New permissions

5.0.5 Release

New permissions

5.0.3 Release

New permissions

5.0.0 Release

Supported permissions

[h2]Open Capabilities Supported by Automatic Signing

Version 26.0.0

6.0.0 Beta5