All Products
Search
Document Center

Cloud Phone:Connect to cloud phones by using ADB

Last Updated:Nov 24, 2025

This topic describes how to connect to cloud phones by using Android Debug Bridge (ADB).

Prerequisites

  1. A key pair is created or imported in the Cloud Phone console. The key pair is bound to a cloud phone. For more information, see Manage an ADB key pair.

  2. To ensure a successful ADB connection from the on-premises environment to the cloud phone, the adbkey (private key) file is stored in one of the following directories based on the OS type:

    • macOS: ~/.android

    • Windows: %USERPROFILE%\.android

  3. The ADB process is restarted in the on-premises environment. To restart the ADB process, run the following commands:

    adb kill-server
    adb start-server

Procedure

Note
  • If the instance group of the cloud phone to which you want to connect uses a shared network, you can establish ADB connections only over a virtual private cloud (VPC).

  • If the instance group of the cloud phone to which you want to connect uses a VPC, you can use the one-click ADB feature (recommended) or establish ADB connections over a VPC or the Internet.

One-click ADB

Prerequisites

Internet access has been enabled for the VPC network where the instance resides. For detailed instructions, see Manage networks.

Procedure
  1. Log on to the Cloud Phone console.

  2. In the left-side navigation pane, choose Manage Resource > Instance.

  3. on the Instance page, find the target instance. In the Actions column, click the ⋮ icon and choose One-click ADB.

  4. In the One-click ADB Connection panel, click Create ADB Connection.

    Note

    If Internet access has not been enabled for your VPC network, click Activate Now in the dialog box that appears to enable it.

    panel_one_click_adb

  5. Wait until an ADB connection is established. You can click the icon to the right of ADB Connection Mode to copy the ADB connect command.

    panel_one_click_adb_created

Next Step

The one-click ADB feature only establishes the ADB connection. You still need to properly configure your security groups to successfully connect to the instance. Ensure your security groups allow inbound access from source IP addresses to the cloud phone using the TCP protocol over port 5555. For detailed instructions, see ADB connection over the Internet.

ADB connection over a VPC

  1. Connect to a cloud computer of the office network that resides in the specified VPC.

  2. Run the following command to connect to the desired cloud phone:

    adb connect <192.168.XX.XX>:5555
    Note

    Replace <192.168.XX.XX> with the private IP address of the cloud phone.

    How do I query the private IP address of a cloud phone?

    1. Log on to the Cloud Phone console.

    2. In the left-side navigation pane, choose Manage Resource > Instance.

    3. On the Instance page, find the desired cloud phone and copy the value in the Private IP Address column.

      f_private_ip_address.png

ADB connection over the Internet

If you want to access a cloud phone by using an ADB key pair from an on-premises device over the Internet, configure a Destination Network Address Translation (DNAT) entry and modify the security group settings.

  1. Create an Internet NAT gateway in the VPC to which the desired cloud phone belongs. For more information, see How cloud phones access the Internet. If you already have an Internet NAT gateway, skip this step.

  2. Create a DNAT entry for the Internet NAT gateway and configure a port mapping rule.

    1. Log on to the NAT Gateway console.

    2. On the Internet NAT Gateway page, find the desired Internet NAT gateway and click Configure DNAT in the Actions column.

    3. On the DNAT Management tab, click Create DNAT Entry.

    4. On the Create DNAT Entry page, configure the following parameters based on your business requirements:

      pg_create_dnat_entry.png

      • Select EIP: Select an elastic IP address (EIP) and record it. The EIP is required when you run commands to connect to your cloud phone.

      • Select Private IP Address: Select Manual Input and enter the private IP address of the cloud phone.

        How do I query the private IP address of a cloud phone?

        1. Log on to the Cloud Phone console.

        2. In the left-side navigation pane, choose Manage Resource > Instance.

        3. On the Instance page, find the desired cloud phone and copy the value in the Private IP Address column.

          f_private_ip_address.png

      • Custom Port: Enter a public port and a private port that you want to map. Sample mapping ports: 1000:5555.

  3. Modify the policy security group of the elastic network interface (ENI) to allow traffic from the Internet to pass over port 5555.

    1. Log on to the ECS console.

    2. In the left-side navigation pane, choose Network & Security > Elastic Network Interfaces.

    3. On the Elastic Network Interfaces page, find the ENI and click its ID. In the Basic Information section, find the first security group and click its ID.

      Note

      In this example, the ENI has two security groups whose names are vda andpolicy. The rules in the policy security group must be modified. After you click the security group ID, you can view the security group name.

      pg_eni_default_security_group_policy.png

    4. On the Inbound tab of the Security Group Details tab, click Add Rule to add the following rule:

      pg_security_group_for_dnat.png

      • Action: Allow.

      • Priority: 1.

      • Protocol Type: Custom TCP.

      • Port Range: 5555/5555.

      • Authorization Object: 0.0.0.0/0.

        Note

        This rule allows traffic from all IP addresses to pass over port 5555. If you want to enhance network security, you can enter the public IP address of the on-premises device on which you run the ADB command.

  4. Run the following command to connect to the desired cloud phone:

    adb connect <Public IP address>:<DNAT public port>
    Note

    Replace <Public IP address> with the EIP associated with the DNAT entry and <DNAT public port> with the public port of the DNAT entry, which is port 1000 in this example.

FAQ

What do I do if network failures or timeout issues occur when I connect to a cloud phone by using ADB over the Internet?

  1. Check whether the command that you run is the same as the following command:

    adb connect <Public IP address>:<DNAT public port>
  2. If the command is correct, perform the following steps to troubleshoot the issue:

    • Check whether an Internet-facing DNAT entry is created.

    • Check whether the public IP address and ports are correct.

    • Check whether the corresponding port is enabled in your security group.

    • Check whether the route table in the VPC that you use is correct. The next hop of the route table must be an Internet-facing NAT gateway for which an SNAT entry is configured.

  3. If the issue persists, submit a ticket to contact Alibaba Cloud technical support.

What do I do if an authentication failure occurs when I connect to a cloud phone by using ADB?

  1. Check whether a key pair is bound to the cloud phone or the adbkey file is downloaded and saved in the on-premises directory.

  2. If a key pair is bound to the cloud phone and the adbkey file is stored in the correct directory, run the following commands to restart the ADB process in the on-premises environment:

    adb kill-server
    adb start-server