1. Obtain Certificates
To publish an app on the HarmonyOS AppGallery, you must apply for official certificates. (During personal development, you might often use auto-signing, but it is not accepted for app submission.) The certificates include p12, cer, csr, and p7b.
Summary: Create a folder in advance to store the four certificates. Generate a p12 and csr certificate in the IDE, then apply for the cer and p7b certificates on the AppGallery Content (AGC) platform, which is Huawei’s app publishing platform.
Detailed Steps:
1.1 Obtain the p12 Certificate
In the top navigation bar of the IDE, find Build, then click Generate Key and CSR.
When generating the p12 certificate, you’ll need to set a password. Write it down—forgetting it means you’ll have to regenerate all certificates from scratch! A hard lesson learned; don’t repeat this mistake!
1.2 Obtain the CSR Certificate
After generating the p12 certificate, click Next to proceed. Select a storage location to save the CSR certificate file.
1.3 Obtain the CER Certificate
To obtain the CER certificate, log in to AppGallery Content. After entering AGC, click “Add Certificate”. The CSR certificate used here should be the one obtained in the previous step. After clicking “Submit” to successfully apply for the certificate, the certificate management page will display the certificate name, certificate type, and expiration date. Click “Download” to save the generated certificate to your local device for subsequent signing.
1.4 Obtain the P7B Certificate
Enter the Profile page as shown below, and click “Add Certificate”. Select the certificate created in the previous step.
Notes on applying for restricted permissions: For example, restricted ACL permissions such as writing to and reading from the photo album. If these restricted permissions are used, you need to check the corresponding boxes here and apply to the platform for the permissions.
Tips: HarmonyOS may not easily grant these permissions. Consider using security components or security pop – ups to reduce the application for restricted permissions.
2. Package the Application
2.1 Configure Certificates
- Open your IDE and navigate to the signing configuration section (refer to the illustration below).
- Uncheck the “Auto-signing” option.
- According to the certificate file extensions specified in the prompts:
- Import the p12 certificate you generated earlier.
- Enter the password you set when creating the p12 certificate (this password is also used for the alias).
- Enter the alias you specified during p12 certificate generation.
Important: Ensure the password and alias exactly match those from your p12 certificate creation step.
2.2 Build the Project
- Click Build in your IDE to compile the application.
- After the build process completes, a new
build
directory will be generated. - Navigate to
build/outputs/default/
. - Locate the file ending with
.signed.app
—this is your signed application package ready for upload to the AppGallery.
3. Publish the Application
- Log in to AppGallery Connect and access “My Apps”.
- Click on the app you want to publish.
- Fill in the relevant app information. The specific details may vary depending on the app, so screenshots are not provided here.
- Upload the app package (the file ending with
.signed.app
built in the previous step).
Once the upload is completed and all the information is filled in, there will be a pre-review mechanism for examination. If it passes the pre-review, it will enter the stage of manual review.
The version of the article and the code used is HarmonyOS 5.0.1 Release SDK.