[Huawei Developers] Mayism:
Environment for Game Release and Testing

1. Have a Huawei mobile phone ready.

2. Connect that mobile phone to a PC using a data cable, and make sure that it remains connected during the game release.

The reason is that a Huawei quick game will not generate a QR code for release, so the data cable is needed during the release process. Otherwise, only one RPK package will be generated during game release in the LayaAir IDE, and you still need to connect the two devices and copy the RPK package to the mobile phone.

3. Install Node.js 10.x. You can download it here: https://nodejs.org/download/release/latest-v10.x/.

4. Install the LayaAir 2.8.1 IDE, or a later version. You can download it here: https://ldc2.layabox.com/layadownload/?type=layaairide.

Preparations

To ensure that your game release goes as smoothly as possible, make sure that you:

1. Have installed Node.js and LayaAir IDE on your PC. You do not need to install the ADB and OpenSSL, as they are built into the LayaAir IDE.

2. Have enabled the developer mode on your mobile phone, and allowed for USB debugging.

If you do not know how to enable the developer mode, you can check Huawei’s documentation at https://developer.huawei.com/consumer/en/doc/quickapp-open-developer-option.

Releasing a Huawei Quick Game in the LayaAir IDE

First, use the release function for the LayaAir IDE to package the Huawei quick game project to an RPK file. Then, open this project in the IDE and go to Project > Release. Select the release platform huawei fast game and set Minimum platform version(1075). Lastly, click publish to release your quick game.

I won’t describe the steps required for release in detail here. If you have any questions, please refer to the official website.

About the Certificate Fingerprint

If the release signature has been generated in the project, you can print the signing certificate fingerprint on the release page. This fingerprint will be used when you submit a Huawei quick game.

It’s important to note that the print button is only available after the release signature is generated. If no signature is generated, the message shown in the following figure will be displayed, indicating that the certificate does not exist.

Running and Testing the Game on a Real Device

After the game has been successfully released on LayaAir IDE, it will automatically run on the Huawei phone in full-screen mode. If you exit the game, you can also launch the Huawei Quick App Loader and tap the game name to restart the game.

Debugging the Game

No tool is available for debugging a Huawei quick game, so you’ll need to make sure that your browser supports the HTML5 version of the game. Debugging your Huawei quick game requires that you check its logs, so you’ll need to retain the default value log for the log level in LayaAir IDE, as shown in the figure below. In this case, both the LayaAir IDE logs and error logs will be recorded. If you set the log level to error, only error logs will be recorded. Both options allow you to view logs after the game’s release. If you select off, no logs will be available.

You can directly view logs on the project release page, as shown below.

You can also open another CLI on your PC to view logs by entering the following command. This method enables you to avoid keeping the IDE open for debugging for a long period.

adb logcat -s jsLog

All logs generated during runtime after the release are displayed in the CLI, as shown below.

If you would like to export logs, please use Huawei Quick App PC Assistant.

FAQs

1. Do Huawei quick games support package splitting?

Splitting the package of a Huawei quick game and loading its subpackages helps reduce the traffic and time required for app downloads. When doing so, you can choose to load or download specific subpackages, rather than the entire package.

Before using this method, you’ll need to determine whether this method is necessary for your project. Most quick game packages are small enough that they do not necessarily require splitting. You can opt to:

(1) Delete unnecessary JavaScript code.

If the package is not split, the JavaScript files referenced in the index.js and HTML files are packaged in the last RPK file, unless these JavaScript files are referenced elsewhere in the project. You can also directly delete the unused JavaScript files, for example, those of unused engine libraries and third-party class libraries, to reduce the package size.

(2) Compress and obfuscate JavaScript files.

This can significantly reduce the file size. If the file size does not exceed 4 MB, you won’t need to split the package, as game content can be dynamically loaded through URLs. After the content is loaded for the first time, it is stored in the physical cache. Common content that occupies less than 50 MB will not be reloaded the next time.

2. When a third-party library, for example, protobuf, is introduced, the gameThirdScriptError error is reported. What should I do?

A potential cause is that the library contains such code as Function(“return this”)();. For security purposes, the game engine disables such code by default. It is recommended that you modify the JavaScript code. In addition to protobuf, the following third-party libraries have similar code. If these libraries need to be introduced, you’ll need to modify the code as well.

If you do not modify the code, you’ll need to enable the runGame parameter, which is not recommended.

For more information, please refer to:

Huawei Quick App PC Assistant materials:

https://developer.huawei.com/consum...ickApp-Guides/quickapp-pcassistant-user-guide

Huawei quick game materials:

https://developer.huawei.com/consum...uickApp-Guides/quickgame-develop-runtime-game