Operations and FAQs of AppGallery Connect Services Demo in Unity - Huawei Developers

If you haven’t downloaded the demo for integrating Huawei services in Unity, you can access the demo on GitHub.
1. How to fix the invalid dependencies error reported during package resolving in Unity?​Project has invalid dependencies:
com.unity.textmeshpro: connect ETIMEDOUT 172.81.232.209:443
com.unity.timeline: connect ETIMEDOUT 172.81.232.209:443
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
When the preceding dialog box is displayed, click Continue to open the project. Go to Window > Package Manager.
Update each package with an exclamation mark to the latest version to resolve the problem, as shown in the following figure.
2. How to switch the platform to Android?​Go to File > Build Settings. In the Platform area, select Android and click Switch Platform.
3. How to fix the Visual C# compiler version error reported after the platform is switched to Android?​If the following error occurs, close the project and then reopen it to resolve the problem.
Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.
4. How to package and run the demo project?​On the Build Settings page, click Player Settings to display the Project Settings page.
Configure the product name as required.
In Other Settings, set a package name for the Android app, which should be identical to that in the JSON file in AppGallery Connect.
In Publishing Settings, deselect Custom Keystore. (If the services you want to integrate involve app signing, skip this step and perform the necessary operations.)
Download the JSON file from AppGallery Connect and save it to the ..\Assets\Plugins\Android directory of the project.
5. What can I do if error “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease” is reported when I package the demo project?​I have selected a device and clicked Build And Run on the Build Settings page, which reported the following error:
org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
Picked up JAVA_TOOLOPTIONS: Dfile.encoding=UTF-8
This problem occurs because the corresponding signature file has been canceled but is still used in the Gradle file.
To resolve this problem, open the launcherTemplate.gradle file in the ..\Assets\Plugins\Android directory, find the following code snippet, and comment it out as shown in the following figure.
6. What can I do if error “launcher-release.apk does not exist” is reported when I package the demo project?​
To resolve this problem, simply select Development Build before packaging the project, as shown in the following figure.

Related

Integrating HUAWEI Game Service Based on Cocos SDKHub - Packaging and Releasing

You can release a Cocos-based game in HUAWEI AppGallery Connect.
1. Building Your Version
Sign in to Cocos Creator, choose Project > Build & Release, and perform configurations as follows:
Select HUAWEI AppGallery Connect as the release platform.
For a joint operations app or game, the package name must end with*.huawei.
Use the keystore information configured previously.
In Cocos SDKHub, select the HUAWEI AppGallery Connect config set you need.
You are advised to deselect Debug Mode. All Huawei SDK APIs require app signature verification, if Debug Mode is selected, the compiler does not sign your app package by default.
2. Compiling Your Version
You can either compile your game in Cocos Creator or Android Studio.
2.1 Compiling in Cocos Creator
In Cocos Creator, go to Project > Build…, and click Compile after the build is complete.
After compilation, you can find the file in $ProjectHome\build\jsb-link\publish\android.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2.2 Compiling in Android Studio
Open the following directory in Android Studio and compile your game.$ProjectHome \build\jsb-link\frameworks\runtime-src\proj.android-studio
3. Uploading Your Version
You can release your game version either by uploading it in Cocos Creator directly after build and compilation, or by uploading the compiled file in AppGallery Connect.
Method 1: Click Upload next to Compile in Cocos Creator. Select a login type, and enter the app ID of your game, which was generated by AppGallery Connect. You can set other parameters according to the actual situation. Click Confirm, and verify your HUAWEI ID in the displayed dialog box. After verification, your game version will be uploaded to AppGallery Connect. You can later sign in to AppGallery Connect and go to My apps > Distribute > Version information to view it.
Method 2: Sign in to AppGallery Connect, go to My apps > Distribute > Version information, click Software package management, and upload your app package.
For more details, check:
Integrating HUAWEI Game Service Based on Cocos SDKHub - Integrating Cocos SDKHub:https://forums.developer.huawei.com/forumPortal/en/topic/0203404602609800136
AppGallery Connect documentation:https://developer.huawei.com/consumer/en/doc/distribution/app/agc-release_app

What Can I Do When the Message "miss client id" Is Displayed During AGC

Background
When I referred to official documentation of AppGallery Connect for APM integration and packaged and run the app, an error message was displayed in the run log:
I/com.huawei.agc.apms: failed to fetch remote config: client token request miss client id, please check whether the 'agconnect-services.json' is configured correctly
The log is as follows.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Another colleague encountered this error when integrating App Linking of AppGallery Connect.
According to the error message, I checked the agconnect-services.json file of my demo project. It was found that the client ID in the JSON file was correct.
Problem Reoccurring
First, I downloaded the sample code from the official website and replaced it with my own JSON file. Then, I checked the run logs and found no problem. This meant that the AppGallery Connect project configuration had no problem.
Then, I opened the demo downloaded from the official website, deleted the client ID from the JSON file, and repackaged and run the demo. Two lines of error logs were displayed, which were different from the preceding message. This was not the cause.
Next, I compared the demo project downloaded from the official website with the project created by me. Then, I found that I didn't add the AppGallery Connect plug-in to the app-level build.gradle file, that is, the file did not contain the code as follows.
I deleted the code about the AppGallery Connect plug-in from the gradle file downloaded from the official website. The problem was reproduced.
Cause Analysis
Finally, we communicated with Huawei technical support to find out the root cause of the problem.
During building of the Android project, the AppGallery Connect plug-in in the gradle file automatically compiles the client ID in the JSON file to the String.xml file in the resource directory.
If the AppGallery Connect plug-in is missing, the SDK in the project cannot obtain the client ID.
Solution: Add the AppGallery Connect plug-in to the app-level build.gradle file.
HTML:
apply plugin: 'com.android.application'
apply plugin: 'com.huawei.agconnect'
apply plugin: 'com.huawei.agconnect.apms'
For details about how to integrate the AppGallery Connect plug-in, please refer to the following:
https://developer.huawei.com/consum...nnect-Guides/agc-get-started#h2-1587477308727
I am getting error message during the build.gradle file compilation: "com.huawei.agconnect" not found. Help me to resolve this issue
riteshchanchal said:
I am getting error message during the build.gradle file compilation: "com.huawei.agconnect" not found. Help me to resolve this issue
Click to expand...
Click to collapse
You may refer to the following link to solve the problem: General FAQs

Integrating HUAWEI Game Service Based on Cocos SDKHub - Integrating the App Update Function

After an app is launched, the app update function checks whether there is a later version available on AppGallery. If so, a pop-up is displayed, asking the user whether to update the app.
After you have integrated Cocos SDKHub, the function will use the SDK to check for app updates.
If your joint operations game is rejected for not integrating the app update function, check this post.
Before you integrate the app update function, you need to integrate Cocos SDKHub. (Reference: Integrating HUAWEI Game Service Based on Cocos SDKHub — Integrating Cocos SDKHub)
After that, here’s how you integrate the function:
1.Add the following code by referring to the official document:
JavaScript:
checkUpdate:function(){
var params = {
"showUpdateDialog": "1",
"forceUpdate": "0"
}
console.log("checkAppUpdate button pressed");
sdkhub.getUserPlugin().callFuncWithParam("checkAppUpdate",params);// Call the checkAppUpdate API.
}
2. Associate the code with a specified button and select the checkUpdate method as the tap event.
3. If you see the error information informing you that the callFuncWithParam method is not found during a simulator test, just test the packaged file on a real device.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
4. If the following information is displayed,
the function is integrated.
XML:
D/jswrapper: JS: checkAppUpdate pressed
I/updatesdk: UpdateSDK version is: 2.0.6.302 ,flavor: envrelease ,pkgName: com.cocos2d.xxx
D/HwConnectivityServiceEx: set 10323 wlan0 value false
I/NetworkKit_a: 27569-28056|null|com.huawei.hms.framework.network.grs.a|a|22|get url from sp is not empty.
I/DeviceUtil: UpdateSDK Get url from GRS_SDK Success!https://store1.hispace.hicloud.com/hwmarket/api/
I/StoreTask: UpdateSDK call store responsecode: 200
If the function passes the real-device test, the error displayed in the simulator test may be caused by compatibility failure.
For a mobile game that needs to be forcibly updated, pay attention to:
1. Select Force update when editing information for the new game version in AppGallery Connect.
(See step 8 in the official document)
2. Set forceUpdate in the input parameters to 1.
This way, you have successfully integrated the app update function.
very useful writeup
Neha J said:
very useful writeup
Click to expand...
Click to collapse
Thank you for your liking.

Result Code 28 Reported During Check for an App Package Released Through the Huawei Channel: Copy the assets directory of the HMS Core SDK to the app

Symptom
When I submitted my game to AppGallery Connect for check, the following message was displayed:
Error 28: Copy the assets directory of the HMS SDK to the app project's root directory.
Cause​I submitted a ticket to Huawei technical support, and they told me that the problem occurred because no .bks certificate file was found in the packaged project.
You can also check whether there are .bks files in the project by using a decompiling tool to decompile the package. The following example shows that .bks files exist in the project.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Outcome​Usually, when an app calls a service API provided by the HMS Core SDK, for example, the sign-in or payment API, if a user's phone does not have HMS Core (APK) installed or the APK version is too early, a pop-up will be displayed to prompt the user to install or update HMS Core (APK).
The .bks files in the app package ensure that the pop-up is displayed as expected. If such files are missing, service functions may fail to work properly.
Solution​
If you use the Maven repository to integrate the HMS Core SDK in Android Studio, the certificate files are automatically stored in the assets directory of the APK.
If you download the HMS Core SDK package for local integration in Eclipse, the certificate files are included in the HMS Base Eclipse SDK package. You can manually copy the certificate files in the assets directory in each of the folder of the HMS Base Eclipse SDK package to your project's root directory by referring to the official documentation.
My project was developed using Eclipse, so I followed the instructions and copied the .bks files. Then, I submitted the package for check again and it passed.

[FAQs] Error Code 50063 Is Returned During the Integration of Health Kit

About the Problem​After an app is integrated with the Health SDK, error code 50063 may be returned when you try to log in to and authorize the app on a HUAWEI phone.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
1. According to Health Kit development guide, error code 50063 indicates that API fails to be called because the installed HMS Core (APK) is not of the required version, which means, you need to update the HMS Core (APK) to the latest version and try again.
2. Uninstall the HMS Core (APK) from the phone, and install the latest version. If the error core 50063 is still returned, go the next step.
3. Call HuaweiApiAvailability#isHuaweiMobileServicesAvailable(Context context) and check the returned code. If the HMS Core (APK) has successfully been installed, the returned code should be 1.
4. Run the adb logcat > log.txt command to obtain complete logs for further troubleshooting.
Troubleshooting​Filter the log by the keyword HMSSDK_, and you will find E/HMSSDK_X509CertUtil: Not include alias 052root.
This message indicates that, no 052root information is found in the hmsrootcas.bks certificate, which causes the verification to be failed, and therefore the login failure. In normal cases, if the SDK is integrated using the Maven repository, the hmsrootcas.bks certificate is automatically saved in the assets directory of the APK.
If no log is available, you can also check whether the hmsrootcas.bks file in the APK contains 052root using a tool.
Solution​1. Check whether the hmsrootcas.bks file exists in the assets directory of the project. If so, delete it, and then the hmsrootcas.bks file will be automatically packed into the APK during app packaging.
2. If the hmsrootcas.bks file does not exist in the assets directory, or the problem persists even after you have deleted it and packaged the APK, manually integrate the BKS file containing the 052root information as follows:
Download the Health SDK.
Decompress the downloaded file, find the hmsrootcas.bks file in the following path, and integrate the file into the hmssdk-eclipse-6.9.0.300\Security-ssl\assets directory of the project.
3. Recompile the project.
References​HMS Core Health Kit
Developer Guide
More FAQs About Integrating Health Kit

Categories

Resources