Read the original article:Practical Guide: Detailed Tutorial for Publishing HarmonyOS Apps
Contents
- Preface
 - Preparations
 - Step 1: Generate P12 file.
 - Step 2: Generate CSR file.
 - Step 3: Generate CER file.
 - Step 4: Generate P7B file.
 - Step 5: IDE configuration.
 - Summary
 
Preface
During the development process, many developers encounter multiple obstacles when publishing apps. Faced with various certificate formats such as .p12, .csr, .cer, .p7b, as well as the app packaging process, many developers feel completely lost and do not know where to start.
This article will provide a detailed explanation of these seemingly tedious yet crucial steps to help you successfully complete the full app publishing process. If you have ever struggled with these issues, please continue reading, and let us uncover the mysteries of app publishing together. Let us get started.
Preparations
Before getting started, please ensure you have:
- Installed the latest version of DevEco Studio.
 - Completed app development and testing.
 - Registered a Huawei developer account and logged in to the AGC platform.
 
Step 1: Generate P12 file.
- Open DevEco Studio and load the project you want to publish.
 - Locate the Build button at the top of the IDE, as shown below:
 
3.In the Build button dropdown menu, find and click Generate Private Key and Certificate Request File:
4.In the pop-up, pay attention to the following points:
- Project alias:Make sure to remember this alias
 - Password settings:It is recommended to use a unified password for easy recall
 - File storage:It is recommended to create a separate folder for each app to store certificate files.
 
5.Click the New button, select the file storage location, and set the password. Then click OK.
Tip: Information such as alias, developer name, and organization only needs to be memorable; strict rules do not apply.
6.After filling in the information, click Next:
7.Upon completion, the .p12 file will be generated in your specified folder:

Step 2: Generate CSR file.
- After clicking Next in Step 1, you will see the following interface:
 
2.In the pop-up, select the storage path for the CSR file, then click Finish:
Note: File names can be defined freely, but meaningful names are recommended for easier identification.
3.After completing this step, you will have successfully generated the .p12 and .csr files:
4.Next, log in to the AGC platform for subsequent operations.
Step 3: Generate CER file.
- In the AGC platform, select Certificates, APP ID, and Profile from the left navigation bar, then click Add Certificate:
 
2.Fill in the required information in the pop-up and upload the CSR file generated in Step 2:
3.After creation, click Download to save the certificate file locally:
Tip: It is recommended to save the downloaded certificate in the same folder as the previously generated files for easier management.
Step 4: Generate P7B file.
- In the AGC platform, go to Profile from the left navigation bar. Click Add on the page:
 
2.Fill in the following information in the pop-up:
- App name:Select the app you want to publish from the dropdown list
 - Profile name:Customize a recognizable name
 - Select certificate:Choose the certificate generated in Step 3
 - Request permissions:Select permissions according to your app's actual needs
 
3.After filling in, click Add:
4.Once added, click Download to save the Profile file locally:
Important: Follow the principle of least privilege when requesting permissions. Only request permissions necessary for the app to avoid rejection during review.
Step 5: IDE configuration.
- After completing the previous four steps, you now have all the required certificate files. Next, configure them in the IDE.
 - In DevEco Studio, go to File > Project Structure.
 - In the pop-up, select the Signing Config tab to configure the corresponding certificate files:
 
4.In the configuration interface:
- Select the previously generated .p12 file.
 - Enter the password set when creating the .p12 file.
 - Select the downloaded Profile file.
 - Ensure all paths are correct.
 
5.After the configuration, click OK to save the settings.
Step 6: Package the app.
- After certificate configuration, select Build > Compile Hap(s)/APP(s) > Compile APP(s):
 
2.After compilation, a build folder will be generated in your project directory.
3.In the build folder, locate the installation package in xxxxx-signed.app format:
4.Upload this installation package to the corresponding version on the AGC platform to complete the app publishing preparation.
Tip: Before uploading, ensure the app has undergone sufficient testing, including functional, compatibility, and performance testing.
Summary
Through this tutorial, we have completed all preparations for publishing a HarmonyOS app, including:
- Certificate generation:Successfully created .p12 and .csr files.
 - AGC platform operations:Generated .cer certificates and Profile files.
 - IDE configuration:Completed signing configuration in DevEco Studio.
 - App packaging:Generated a signed app installation package. Although these steps may seem cumbersome, each one is critical to ensuring your app can be successfully published on the Huawei AppGallery. Wishing you a smooth app publishing experience. Class dismissed.
 















    
Top comments (0)