Ankit Chandawala

I'm a software engineer with experience in mobile, backend and distributed systems

Use ADB over WiFi

02 Mar 2020 » programming

ADB is a command-line tool that lets you communicate with a device. It is a client-server program that includes three components:

  • A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
  • A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
  • A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.

One of the problems that sometimes arises with using ADB is to connect to the device without it being connected to your local machine via a USB cable. However, ADB makes it possible to connect the device over WiFi because of it’s simple server-client architecture.

To connect to ADB over WiFi, you just need to follow these steps.

Pre-requisites

  • Connect the device to your development machine via a USB cable.
  • Verify the device can be used by running adb devices. The device should be listed.

Next, run the following commands:

  • You will need the IP address of the device you need to connect to. To get the IP address, run:
adb shell ip addr show wlan0 | grep "inet\s" | awk '{print $2}'
  • To start ADB over TCP/IP connection, run:
adb tcpip 5555
  • Now, just start the ADB connection by running:
adb connect 192.168.0.25:5555

Don’t forget to replace the above IP and port with the IP of your device and the port you actually used in the commands above.

That’s it. You should now be able to remove the cable connecting the device and see that adb commands will continue to function.