DEV Community

Cover image for HarmonyOS Flutter Practice: 13-Harmony Application Packaging and Listing Process
shaohushuo
shaohushuo

Posted on

HarmonyOS Flutter Practice: 13-Harmony Application Packaging and Listing Process

Create an application

Create a new project

  1. In AppGalleryConnect, My Project, Add a project.

Create a new APP ID

  1. In AppGalleryConnect, Certificate, APP ID and Profile.

Select the project

Create a new application/meta-service

Click Publish on the right side of the APP ID, and the release window will pop up HarmonyOS Application/Meta-Service

Fill in the application information as prompted, upload the application icon, select the application category and label, and click Next

Upload the packaged App (see below).

Fill in the application information, company information, etc. It should be noted that the App needs to provide software copyright, but the meta-service does not.

Package Signature

Automatic Signature

If it is for development and testing, you can use automatic signature. (File -> Project Structure -> Signing Configs, check Automatically generate signature)

If you are packaging and putting it on the shelf, you need to sign manually

Open DevOps and perform the following operations in sequence

  1. Click Build > Generate Key and CSR in the main menu bar

  1. If you have not created a Key Store, click New to create one

Select the directory to be stored (use .p12 as the file extension), enter a complex password of more than 8 characters, and click OK.

  1. Set the Key alias

Click Next to proceed to the next step

Set the CSR storage location. Note that the file name needs to use .csr as the extension.

Click Finished, and the .p12 keystore file and the certificate request .csr and other files will be created.

Log in to AppGallery Connect, and do the following

  1. Click Certificate, App ID and Profile, click "Add Certificate" in the Certificate column, upload the CSR file created above, and a cer file will be generated.

Click the Download button to save the certificate file and package it for use in the APP.

  1. In the Certificate, App ID and Profile column, click Add, create a Profile file, and select the certificate just created

Package App

In DevEco, open File -> Project Structure -> Signing Configs, there will be a default signature configuration created by default, click + Add button,

Select the .p12 file, .p7b file created above, and the downloaded .cer file, enter the password, and click Apply to generate the configuration.

Click the Product 🔘 button in the red box, select release as the Build model, and configure which signature to use in the build-profile.json5 file

"products": [
{
"name": "default",
"signingConfig": "release",
}
]
Enter fullscreen mode Exit fullscreen mode

Click Build-> Build Hap(s)/APP(s), select Build APP(s), and start APP packaging.

After successful packaging, a .app file will be generated in build/outputs/default in the project root directory, which is the file package we want to upload to the app market

FAQ

Package parsing failed. For detailed information, click the error code in the package management list to view it. Please repackage and upload according to the instructions.
993, Profile file is illegal

Check the signature configuration file to see if it is the release configuration

build-profile.json5

As shown in the following configuration, two signature configurations are added here, one for development scheduling and one for packaging and listing

"signingConfigs": [
{
"name": "default",
"type": "HarmonyOS",
"material": {
"certpath": "xx",
"storePassword": "xxx.cert",
"keyAlias": "debugKey",
"keyPassword": "xxx",
"profile": "xxx.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "xxx.p12"
}
},
{
"name": "release",
"type": "HarmonyOS",
"material": {
"certpath": "xx",
"storePassword": "xxx.cert",
"keyAlias": "release",
"keyPassword": "xxx",
"profile": "xxx.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "xxx.p12"
}
}
],
"products": [
{
"name": "default",
"signingConfig": "release",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS",
"buildOption": {
"strictMode": {
"caseSensitiveCheck": true,
"useNormalizedOHMUrl": true
}
}
}
],
Enter fullscreen mode Exit fullscreen mode

When packaging and listing, you need to ensure that the signingConfig above uses the signature configuration named release

References

-Application/Service Signature

Top comments (0)