目录

Debugging a Quick Game

Prerequisites

Debugging Procedure

If an error occurs during running or debugging, you can locate the fault based on the local logs of the tool. For details, please refer to How do I view the detailed error logs of Huawei QuickGameAssistant?.

  1. Open QuickGameAssistant and sign in using the same HUAWEI ID used for Petal Lite Games.

    The HUAWEI ID used for signing in to QuickGameAssistant must be the same as that used on the connected phone.

  2. On the wizard page, click Open Project, select a local Runtime project directory, and enter the quick game's app ID.

    The project path cannot contain Chinese characters.

  3. If the project does not have a signature file, choose Tools > Generate Certificate on the menu bar to generate a certificate file. For details, please refer to Generating a Signing Certificate.

  4. Ensure that the phone is connected, and then click the run button.

  5. Run the quick game on the mirrored phone screen.

  6. If any issue is found, click the debug button. Debug and solve the issue in the debugger window. For details, please refer to Debugging Method.
    1. Step 1: Set breakpoints. You can set breakpoints at the line numbers of key code lines.
    2. Step 2: Perform debugging. Refresh the page and click the trace button to step through the code. The program will automatically pause at your breakpoints.
    3. Step 3: Check the code. At each breakpoint, you can inspect the execution state of the current line to pinpoint the exact location of the error.

    • The tool supports undocking and docking the debugger window. For a better debugging experience, we recommend undocking the window. To re-dock the debugger window with the tool, click the debug button again.
    • If the ADB port is occupied or the ADB version is incompatible with the tool's built-in ADB commands, please refer to How do I use the ADB provided by Huawei QuickGameAssistant?.
    • If a quick game runs normally but shows a black screen during debugging, it is due to a version mismatch between Petal Light Games and this tool. To resolve this, uninstall Petal Light Games from your phone, and then click the debug button. Once the tool automatically installs the built-in version of Petal Light Game, the issue can be resolved.
  7. Click the stop icon to end the debugging.

Debugging Method

Debugging is the process of identifying and fixing errors within a script. It also allows us to step through code line by line to inspect the actual execution in real time.

[h2]Step 1: Setting Breakpoints

Breakpoints are markers where the browser debugging tool automatically pause execution; at a breakpoint, you can inspect current variable values, execute commands in the console, and perform other debugging operations. The steps are as follows:

  1. Select a page file, such as an HTML or JS file, on the left of the Sources pane, and click the line numbers in the middle source code area to set breakpoints. You can view all breakpoints in the Breakpoints column.

    You can click to display the file pane, and click to collapse the resource pane to expand the code editor view.

  2. You can write your own debugging code near the breakpoint.

[h2]Step 2: Performing Debugging

Reload the page and click the debugging button on the Sources pane to start tracing the code execution. The program will pause at each breakpoint. You can view the current call information in Call Stack.

The following table describes the debugging buttons.

Button

Button Name

Shortcut Key

Description

Resume script execution

F8

Automatically executes all code before the next breakpoint and pauses at the breakpoint.

Step over next function call

F10

Similar to Step, but skips built-in functions, such as alert. If you are not interested in the internal execution of built-in functions, you can click this button.

Step into next function call

F11

Similar to Step, but bypasses the asynchronous behavior of asynchronous functions.

Step out of current function

Shift+F11

Automatically executes the remaining code in the current function, exits the current function, and pauses at the next line of code that calls the current function. If you accidentally enter an irrelevant function, you can click this button to quickly execute the remaining lines and exit the current function.

Step

F9

Executes code line by line.

Deactivate breakpoints

Ctrl+F8

Enables or disables all breakpoints. This button does not affect program execution.

-

-

Enables or disables automatic pausing of script execution when an error occurs. If the script is suspended due to an error, enable this function, reload the page, view variables in Sources, analyze the context, and locate the fault.

[h2]Step 3: Checking the Code

At each breakpoint, you can inspect the code execution status in the Console pane or on the right of the Sources pane.

Applying for Permission Control

To strictly limit the HUAWEI IDs authorized for debugging, you can send an email as follows to Huawei personnel. Once configured, only designated HUAWEI IDs will be permitted to debug the quick game in QuickGameAssistant.

Email Subject

Restricting HUAWEI IDs for Quick Game Debugging in QuickGameAssistant

Email Content

  • Developer ID of the primary account in the team account
  • Quick game app ID
  • Quick game name

Email Address

minigame@huawei.com

If the primary account in a team account has permission to debug a quick game, the primary account can grant the permission to other member accounts in the team.