Connecting to Android Device with ADB over WiFi made (a little) easy

Amanshu Raikwar
3 min readMay 10, 2019

If you are an Android developer, I am 100% sure you might already be frustrated with debugging your App with ADB while being connected through a USB cable. If you didn’t know already, you can connect to your Android Device with ADB over Wifi. But, it still requires you to ‘do stuff’. So, I wrote a Shell Script to make this a one-click process and I’ll be sharing the same in this post.

Note: I wrote this script on a mac which means this sould run on other linux based machines with small or no modifications. Windows users can use ideas from this post to implement it themselves.

Photo by Farzad Nazifi on Unsplash

But first, how to even do it manually?

Follow the steps given below:

  • Enable USB debugging in the Android device.
  • Connect the device to the computer via a USB port.
  • Press allow in the permissions dialog if prompted.
  • Find out where the adb binary is present on your computer. For a mac, it is generally present in
  • Browse to that location and open a terminal window.
  • Type below command to check if your device was successfully connected.
./adb devices
  • The output will look similar to
  • If you can’t figure out which one is the intended device, type below command to print device information.
./adb devices -l
  • If your device is not visible make sure you didn’t miss any of the above points. Redo the above steps again if that solves your problem.
  • In the output of the above command, the first word is the device id. We will use that to connect to the Android device over WiFi.
  • Make sure the Android device and the computer are connected to the same WiFi network.
  • Type below command to restart the adb in tcpip mode for the device.
./adb -s <device id> tcpip 5555
  • The output will look like this
  • Find out the local IP address of the Android device. You can find this information by pressing/long-pressing the WiFi icon in the quick settings drop-down and then clicking the WiFi network you are connected to.
  • Type below command to connect to the device over WiFi.
./adb connect <IP address>:5555
  • The output will look like this
  • If the command ran successfully, you can now disconnect the USB cable and enjoy debugging over WiFi.

Too many steps!

Now we will automate the above process (a little) using a shell script.

The mighty but tiny Shell Script

The script is pretty self-explanatory. Just copy the script in the folder where adb is present, name the file adbwificonnect and use as mentioned in the file.

How does it work?

  • First, the available devices are listed down.
  • Then the device id of the chosen device is extracted using the awk command. For option -a, all the available devices are chosen.
  • For every chosen device, adb is restarted in tcpip mode.
  • To find the IP address of the device, ifconfig command is run in the device’s shell using adb and the device id, and inet addr value of wlan0 network interface is extracted.
  • Then the device is connected using adb and the IP address.

Happy debugging!



Amanshu Raikwar

Software Engineer (little 'kotlin' lover) and free time Photo Clicker.