ADB connects Android devices via WiFi

Source: Internet
Author: User

Issue background

In the recent project test, the mobile device and the manufacturer machine should be connected with the USB video transmission (projection screen). Testing process needs to locate the problem, often need to check the real-time log, mobile device has and manufacturers of machine USB connection screen, can not be connected to the PC with USB, then there is any way to solve the above problem?

ADB supports USB connection mode and TCPIP connection mode, we can connect adb wirelessly via WiFi in TCPIP mode.

Other application Scenarios

When the USB cable is relatively loose, the ADB connection is often disconnected, the USB cable connection, the mobile phone assistant and other programs will automatically connect to ADB, which often leads to the ADB disconnection; using WiFi to connect adb can reduce the problem, which is also very helpful for testers.

The specific connection steps are as follows:

1, confirm that the native PC does not have any ADB device connection, including simulator and USB connection

See how many devices the current PC-side connection has

After the ADB devices command, the list is displayed as empty;

2. Connect the remote Android device to Wi-Fi and view its IP address

To see the IP address of your Android device, here are three ways to view your Android device IP.

(1). Settings-About mobile-status information-ip address in view

(2). Set-wlan-Click Wi-Fi on the current link to view IP

For example: Set-〉 wireless or network---〉wlan settings-〉 view the IP address of the currently connected Wi-Fi (some models need to press the menu key and select the "Advanced" option---〉IP address)

(3). View device IP address via adb command: ADB shell netcfg

Premise: (The device has a USB connection with the PC)

Make sure that your PC and Android device are connected to the same WiFi network environment (same LAN, communication)

3. Ping the IP of the Android device under the native Command command

For example, ping 10.129.49.143, if Ping is successful, indicates that you can connect

Ping successful

4, execute ADB Connect

Once you know the device IP address, you can use the ADB Connect command to connect to ADB via IP and port number.

ADB Connect 10.129.49.143

If the connection is successful, you can continue with the following action, if it is unsuccessful, as shown: Connect rejects


Restart ADB with adb tcpip mode

ADB tcpip 5555


Connection successful, connected to 10.129.49.143:5555

All commands for the original USB connection can be executed after the ADB connect IP connection is successful

such as ADB install,adb Logcat etc, for project testing when WiFi connection Android device, in Androidstudio environment, view real-time log


Androiddebug Bridge

We are generally referred to as ADB, it is a very powerful command line tool that you can communicate with your Android device through the ADB tool. ADB is a C/s mode-based program that contains the following three components:

1) ADB client (clients)

The client is run on the PC side, and the component sends commands that can be called from the command-line terminal by issuing the ADB command. Each time we launch an ADB command, a client program is opened. Of course, when we open DDMS or ADT, we also create the client automatically. When we open a client, it first detects whether there is a server program running in the background, or it will open a adb-server process. All clients communicate with the Adb-server via Port 5037.

2) adb daemon (adbd daemon)

Daemon, the component runs in the emulator/real Android device as a background process, running commands on the device. Daemon uses a port range of 5554-5585, each emulator/device connected to the PC side, always open such a background process, and allocated it two consecutive ports, such as:

Emulator1, console:5554

Emulator1, adb:5555

Because each device is divided into a group of two ports, the maximum number of ADB-connected phones is 16.

Ports, where even-numbered ports are used by the server to interact with the device, allowing the server to read data directly from the device, while odd ports are used to communicate with the adbd of the device.

3) ADB server (server)

The Server, which manages communication between the client and the daemon, runs as a background program on the PC side. When a server is turned on, it automatically binds and listens on port 5037, receiving commands sent by the client over that port. The server also scans 5555-5585 odd ports to locate connected devices.

ADB connects Android devices via WiFi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.