👨🏼‍💻How to Implement Signing Configs manually on HarmonyOS Project
Introduction
Hello friends, today I will tell you step by step how we perform the signing configs operations in the scenarios that we can’t perform automatically in HarmonyOS projects. Happy reading.
on this website let’s log-in with Huawei ID and open my projects section.
AppGallery Connect Steps
Let’s choose add a project on the page and create a new project.
Choose project name and create it.
Click to add app button to add an app to this project.
On this page, let’s choose platform, device selections, app name, package name, app category, and default language features and press OK. We will use this information later while creating a project on DevEco Studio.
On this page, let’s click the cancel button and skip this step. We will do it later.
We have created our project and app. Now, let’s open DevEco studio and create a project on it.
Open DevEco Studio and click Create Project.
I chose empty ability for an instance. You can choose different templates which suit your project. Press next to continue.
Let’s fill the project configurations. Set project name, project type, bundle name, save location, development mode, language, compatible API version, device type variables, and click the finish button.
We created a project. Now, we will create KEY and CSR under the Build section.
First, we will create keystore file. Click the new button and decide the path. I recommend the path which the project belongs. Press OK to create the file chosen path. Then set the password and press OK.
Define an alias to the key which you generate and fill the certificate’s information and press Next to generate it.
Now we will create CSR. For the CSR file define a path and name and press OK. Then click Finish button to end process.
On the AppGallery Connect, in the users and permissions page, navigate to the certificate management page.
Here, let’s click on new certificate at the top right, specify the path of the csr file we created and upload it, then let’s click submit and finish. The certificate we created is now visible in the system. Let’s download this file. And let’s move the downloaded file next to the other file we created.
Now let’s switch to the device management page on the user and permission page. Here we will add the device that we will use while developing. It will ask us for your device name, type, and UDID values. UDID acquisition methods are similar for smartwatches, Vision products, and mobile phones.
The methods for obtaining a UDID are similar for smart watches, Vision products, and mobile phones. The following uses smart watches as an example:
Go to Settings > About on your smart watch and keep tapping Build number until a message indicating that you have entered the developer mode is displayed.
Go to Settings > Developer options and enable HDC debugging.
Connect the PC to the smart watch (for devices which has wifi debugging connect pc and device same wifi network) and then start the command prompt, to use hdc shell, run “C:\Users\YourUserName\AppData\Local\Huawei\Sdk\toolchains\hdc shell” this command. Don’t forget change YourUserName section with your user name. After hdc shell is displayed, run bm get --udid to obtain the UDID of the watch.
For sports watches, contact Huawei operations personnel via agconnect@huawei.com to obtain the UDID.
After adding the test device, let’s go to the project we created through my project and go to the HAP Provision Profile page under HarmonyOS app services at the bottom left. From here, click the add button and fill in the necessary information and submit.
Then let’s download this file and move it to where our other certificates are.
Let’s open the project structure under the File tab. Move on to project from the left. Click on the signing configs tab in the top right. Remove the Automatically generate signing tick on the page that opens. Give the paths of the certificates we collected in the same place. Fill in the alias and password information of the key we created and press Apply.
Let’s go to the modules section from the left and open the signing configs. Repeat the same process and press OK.
That’s it for manually implementing signing configs. Finally use this information to connect pc and watch.
Run “adb connect 192.168.1.X:XXXX” command on command prompt. After this step you will be able to see your device on DevEco Studio.
Let’s download the agconnect-services.json file from this page and add it to the project’s folder.
Conclusion
When you run the application, the Hello World text will greet us. That’s it for now, thanks :)