The preparatory work

  • Phones and computers need to be on the same LAN
  • The ADB tool is already installed on your computer, either Mac or Windows

start

1. Open the mobile phone port

Enable the mobile phone to receive TCP/IP connections on the specified port.

  1. Make sure your phone has USB debugging turned on
  2. Connect your phone to your computer with a USB cable
  3. Execute command:adb tcpip 5555

After successful execution, you can unplug the USB cable. The port may not be 5555, which is officially used by default.

2. Find the IP address of the mobile phone

Generally found in Settings – About phone – status information -IP address.

For example, I see here that the IP address of the phone is 192.168.1.100

3. Connect to the mobile phone through the IP address

Execute command:

The adb connect 192.168.1.100:5555Copy the code

If prompted:

Connected to 192.160.1.100:5555

If the port number is 5555, the connection is successful.

The adb connect 192.168.1.100Copy the code

4. If the connection is not successful

If you are sure that your network and port are ok, try restarting the ADB service:

adb kill-server

Then connect, or Google if you can’t.

5. The connection is successful

If the connection is successful, run the following command to view the list of currently connected devices:

adb devices
Copy the code

You can see the connected device, like this

$ADB Devices List of Devices Attached 192.168.1.100:5555 device

You can debug your phone or run automated tests on it without a cable.

Matters needing attention

  1. Use the new IP address to connect to another network.
  2. But if the phone is restarted, you need to reconnect the cable to open the port again.
  3. The port can be opened through ADB or directly on the mobile phone, but generally requires root permission and special software.