Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

android
adb
debugging
communitycreator

Debugging physical Android devices through WiFi

Mohammad Rahhal

All that this requires is a few easy commands using adb! Of course, this works the exact same way no matter the language or IDE you use in development.

Finding adb

adb is a tool that comes installed with the Android SDK. First, we’ll need to find where it lives.

Usually, the Android SDK is located in the following locations:

  • Linux: ~/Android/Sdk
  • Mac: ~/Library/Android/sdk
  • Windows: %LOCALAPPDATA%\Android\sdk

If you can’t find your SDK here, you can find its location from the SDK manager in Android Studio.

You’ll find adb and other platform tools under the “platform-tools” folder. We’ll open a command line here to issue commands using adb.

You can add this folder to your path so that it’s easier to run the commands anywhere.

Going Wireless

Start by plugging in your Android device to your machine. We’ll only have to do this the first time.

Now, we have to execute several commands in the command line that we opened in the SDK’s “platform-tools” folder.

List the currently connected devices to confirm that our plugged-in device is attached:

$ adb devices
List of devices attached
HTXXXXXX   device

Tell adb to run its TCP server:

$ adb tcpip 4444
restarting in TCP mode port: 4444

Find your device’s private IP address in your network and execute this command:

$ adb connect [device-ip-address]:4444
connected to [device-ip-address]:4444

If, for example, my device’s IP address is 192.168.86.2, we’ll execute the following:

$ adb connect 192.168.86.2:4444
connected to 192.168.86.2:4444

Let’s list the devices again to confirm that the device is now connected through WiFi:

$ adb devices
List of devices attached
HTXXXXXX    device
192.168.86.2:4444       device

You can now unplug your device and enjoy a cable free debugging experience! Your device will appear in whatever IDE you’re using as if it’s connected normally.

Next time, you’ll ​only need to execute this last command without even plugging your device:

$ adb connect [device-ip-address]:4444

If this fails, you may​ need to retry the process from the start.

RELATED TAGS

android
adb
debugging
communitycreator
RELATED COURSES

View all Courses

Keep Exploring