DEV Community

Cover image for Wireless Debugging in Android
Dilip Chandar
Dilip Chandar

Posted on

Wireless Debugging in Android

An interesting and useful feature in android is wireless debugging. This helps us achieve whatever we can do through USB cable like debugging, catching logs in logcat by unplugging our device once wireless connection is established.

Before we establish a wireless connection, we have to keep our device connected through USB cable. Once developer options are enabled, we will be able to see our device in Android Studio. In this article, steps are covered for Mac OS.

Step 1: Open Terminal and go to platform-tools directory. For example

cd Library/Android/sdk/platform-tools

Step 2: Check if adb command is working by typing

adb devices

Step 3: If Step 2 fails by a message zsh: command not found: adb, type the following in terminal. For example

export ANDROID_HOME=/Users/dilipchandar/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Step 4: After Step 3, entering the command adb devices will show us list of devices like this

List of devices attached
28c95c50 device

Step 5: Now we need to establish TCP IP connection with a port number by typing following command

adb tcpip 5555

Above command will display -> restarting in TCP mode port: 5555

Step 6: Finally we can enter the following command after getting our IP Address from our phone’s WiFi Settings. For example if our IP Address is 192.168.1.4

adb connect 192.168.1.4:5555

Above command will display -> connected to 192.168.1.4:5555

We will see the list of devices like the below

List of devices attached
28c95c50 device
192.168.1.4:5555 device (shows device is connected wirelessly)

After this, we can disconnect USB cable and check Android Studio. We will see the device with IP Address in logcat as shown in screenshot

Please note that wireless connection may have to be reactivated if device goes offline by entering command from Step 6 again. That’s all about wireless debugging. Thanks for reading. Happy coding!!

Let’s connect on LinkedIn https://www.linkedin.com/in/dilip-chandar-97570158?

Top comments (0)