目录

Using the Emulator

Since version 6.1.0 Release, Command Line Tools integrates the Emulator, supporting Windows and macOS platforms for independent emulator operations such as emulator creation, startup, shutdown, and image download.

Since version 26.0.0, the Emulator is available on the Linux platform. For details, see Using the Emulator on Linux.

To use Command Line Tools on macOS, if a dialog prompts that the Emulator cannot be verified by the developer check, you can go to Settings > Privacy & Security and select Open Anyway for the Emulator, or use the Emulator under the DevEco Studio directory.

Environment Setup

The Emulator is located in the emulator directory under the command-line-tools installation directory. You can run commands in either of the following ways:

Emulator Commands

For details about Emulator commands, see Using the Emulator via the CLI.

Pushing Packages and Debugging on the Emulator

You can use the hdc tool to push packages and debug on the emulator.

  1. Before use, verify the connection between the emulator and hdc. The IP address and port number of the emulator are 127.0.0.1:5555. If the port number is occupied, it increments by 2 starting from 5555, for example, 5555, 5557, and 5559, with the range between 5555 and 15555.
    hdc list targets
  2. If the connection is not established, run the hdc tconn {IP address:port number} command to connect to the emulator. For example:
    hdc tconn 127.0.0.1:5555
  3. After a successful connection, use hdc to install or uninstall apps on the emulator. For details, see About This Kit.

Using the Emulator on Linux

Since version 26.0.0, the Emulator can be used on the Linux platform.

[h2]Environment Setup

Currently, only Ubuntu 18.04 and later versions are supported. Before using the Emulator, install the required dependencies. For example, if you are using Ubuntu 18.04, run the following command:

apt install -y libatomic1 libpulse0 libegl1 libgbm1 libgl1 libpng16-16 libfontconfig1 libfreetype6 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libxcb-xkb1 libsm6 libice6 libxkbcommon-x11-0 libxkbcommon0 libglib2.0-0

[h2]Constraints

[h2]Emulator Command Differences

For the Linux environment without a GUI, the command for starting the emulator must contain the -noWindow parameter. Other commands are the same as those for Windows and macOS. For details, see Using the Emulator via the CLI.