Using ADB on WiFi for Android Development

Posted in Engineering

## Using ADB on WiFi for Android Development

I used to struggle a lot when developing an Android application, mostly because the emulator is slow, and when using real device for development, the USB cable needed to connect my phone with my laptop is just as annoying as the slow emulator.

Luckily, ADB supported WiFi to connect the debug bridge between my phone and my laptop. Since then, I only used USB cable for setting up the ADB WiFi connection. Though most of the time I still enjoy using emulator because and the emulator has been made faster.

Setting Up the ADB to Connect Over WiFi

First, you have to connect your phone with your computer using aa USB cable. Make sure that the ADB detected your phone. If not, you might need to update the driver that connects your phone and your computer.

Second, open up a command prompt and navigate to your Android SDK location (on Windows you can find it inside your user folder if you install it on the default location e.g: C:\Users\YOUR-USERNAME\AppData\Local\Android\sdk\platform-tools). You probably want to add this path to your $PATH variable.

Type android devices -l to see list of the connected device. You should see your phone on the list.

You should see your phone on the list of devices attached.Then type adb tcpip 5555 to run the ADB in TCP mode. The number after tcpip is the port you want to attach the ADB server on your phone. I use 5555 because it is easy to remember and no apps should be using that port.

You should see that the ADB server is restarting in TCP mode.You can now plug off the USB cable from your phone and computer, and then connect to your phone via WiFi by typing adb connect :5555 or any port you set the server to be running on, and try running adb devices -l again to check if the ADB TCP server is working correctly.

After you connected to the ADB via WiFi, you should be able to see your phone on the devices list even when the USB is detached.Everything should be set, if you press the Run or Debug button on Android Studio, you should see your device on the list of available devices to run your app on.

Say goodbye to USB cables and broken USB port on your phone.