Problems and Troubleshooting During Cocos Integration with AGC Services - Huawei Developers

Some problems may occur when the APM SDK is integrated into a Cocos-based app and during app release. This article summarizes some common problems and talks about how to deal with them.
1. Problem: Error message "[NDK Root] is empty, please set [NDK Root] in Preferences." is displayed when you build an Android project for the first time, indicating that the NDK is unavailable.
Cause: The Android NDK and Android SDK paths are not configured when the project is built.
Solution: Go to File > Settings... in Cocos Creator, click the Native Develop tab page, and set Android SDK Root and NDK Root.
{
"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"
}
You can obtain the required Android SDK and NDK paths from Android Studio, as shown in the following figures.
Copy and paste the preceding paths to Cocos Creator, and go back to the Build... page for further operations.
Note: In some cases, a default NDK path may not exist. You can download the NDK here in Android Studio.
2. Problem: Error message "TypeError: Cannot read property 'xxx' of undefined." is displayed.
Cause: A script with the same name exists on the computer. This problem may occur regardless of whether the scripts of the same name are in the same folder.
Solution: Ensure that each script has a unique name by renaming or deleting scripts.
3. Problem: Error message "Task:game:externalNativeBuildReleaseFeature" is displayed during compilation, but the building process is normal.
Cause: The path contains special characters or is too long.
Solution: Place the project folder in the root directory and ensure that the project file name does not contain special characters. Then delete the build folder and try again.

Related

[Q] Eclipse and external libraries

Hi everyone :victory:
So, first of all, I'm not a java developper, I never done any java in my life, only C and C++, and i'm used to have .c/.cpp files along with .h files.
That being said, I can still understand the syntax of Java, however I don't fully understand how Eclipse is supposed to work.
I've followed a few guides on the web in order to get started and to be ready to compile APK from pre-existing code (I just want to modify a Xposed Module), and here's what I've done.
Install Eclipse
Install ADT
Update ADT and install Android SDK
Get the xposed module code from GitHub
I've then went to File -> New Project --> Android Folder --> Android Project from Existing Code, and I've selected the xposed module folder.
So far everything works, I've even found how to add the XposedBridgeAPI.jar in my project (not an easy thing to do and I'm not sure i've done it the correct way, but no more Eclipse error about Xposed functions )
But I now encounter another problem which is that I can't find a way to import this library : Android-DirectoryChooser into my project :crying:
{
"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"
}
I've tried to follow the instructions given on the GitHub :
Import the project into your favorite IDE and add android.library.reference.1=/path/to/Android-DirectoryChooser/library to your project.properties.
Click to expand...
Click to collapse
but it doesn't change anything ... :silly:
I've been struggling with this for hours now, can someone tell me what I've done wrong or what to do ?
Thank you in advance.
Regards,
Azsde.
Edit : I found the solution, I just needed to make a '' libs'' folder at the Root of my project, with my jar inside

Compiling renderscript code at runtime

I was wondering if it's possible to write/modify renderscript code when the android application is running.
My main goal is to make an app where users can learn to work with renderscript without any java knowledge. The basic layout of the app would consist of an input and output image, with the possibility for code input. The basic functionality of this app is already working and this is an image of the interface.
{
"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"
}
It would be useful to test renderscript code with direct feedback from the app.
I've already done research about the build process and came up with the following idea:
A basic "template" renderscript file, with the necessary global variables like in and out allocations.
My java code would create a script object of the generated java class and do the basic initialization of these global script variables.
The root function of this template .rs file would be empty, and it should be possible to be implemented by the user at runtime.
When the user types in his code in the main view of the app, the code is written to my own .rs file which then is compiled by the llvm-rs-cc compiler, invoked by the application. The generated .bc would then be copied to the location of the original .bc file of
the template. Because the only change of code happens inside the root function, it would not be necessary to make changes to the surrounding
java code.
The problem I'm having at the moment is the fact that the .bc files are bundled within the final apk inside the res/raw folder,
which is not accessible by the app. Overwriting old .bc files with the newly generated files is therefore not possible.
Is there a(nother) way to compile renderscript code at runtime?

Resolving HTTP 502 Error During Leaderboard API Calls

Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"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"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
HTML:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt

How Can I Use the HUAWEI Game Service Demo Provided by Unity? - Part2

The Content of part1 is here.
Generating and Configuring a Signing Certificate Fingerprint
Use the preceding signature file to generate a signing certificate fingerprint by referring to Huawei documentation, and configure the fingerprint in HUAWEI AppGallery Connect.
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/appgallerykit-preparation#h2-1604304489444
{
"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"
}
Packaging and Running the Demo
Step 1: Choose Android from the Platform area, and click Switch Platform.
Step 2: Click Build And Run and select the preceding signature file.
If this message is displayed, you can manually delete useProguard in the launcherTemplate.gradle file.
In this example, the following two lines are deleted.
Package and run the demo again.
Step 3: Check whether the packaged demo is normal.
Once you have packaged and run the demo, the following page is displayed.
Click Init. A message is displayed, indicating that the operation is successful.
Click Login and then login. The HUAWEI ID sign-in page is displayed, indicating that the demo is running successfully.
You can view the method of calling APIs for the demo in the following file in Unity, and call the corresponding APIs.
Note: If the sign-in page is not displayed, and the 6003 result code is returned, the signature fingerprint may be inconsistent. For details about how to fix this problem, check this post: What Can I Do When Result Code 6003 Is Returned?
Part1 of this thread: https://forum.xda-developers.com/t/...rovided-by-unity-part1.4212917/#post-84224243

What should I do when error code 60002 ("iap not activated") is reported and the payment page cannot be opened?

Problem:
I was testing in-app purchases for my app but the payment page failed to launch. The log information 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"
}
I checked the error code description in the official materials and found that it was because HUAWEI IAP wasn’t enabled. I checked the switch, and found that IAP has been enabled, but the problem persisted.
Analysis:
To resolve the problem, toggle on the IAP switch and configure IAP parameters, as shown in the following figures.
Document for enabling a service
2. If you used Android Studio to integrate the IAP SDK, download agconnect-services.json again by referring to the following figure and save the file to your app’s module directory of your project.
If you use Eclipse to integrate the SDK, check whether the appid and cpid parameters are correctly configured in the Manifest file.
Sample code:
XML:
<meta-data
android:name="com.huawei.hms.client.appid"
<!-- Replace xxx with the actual app ID, which can be obtained on the App information page. - ->
android:value="appid=xxx">
</meta-data>
<!-- Replace xxx with the actual payment ID, which can be obtained from the app's IAP information. -->
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="cpid=xxx">
</meta-data>
3. Once you have finished the preceding steps, if the problem still exists, wait for a while and try again, because there may be a one-hour delay due to cache issues.

Categories

Resources