Netskin Logo

Connecting Android Devices via TCP instead of USB

#android
by Michael Blum on 03.03.2022

When developing Android applications, at some point you might want to deploy your app on a real Android device. Every app developer knows, that in this case you activate the “developer options” on your Android device, connect it to your laptop via USB port and you are good to go!

However, sometimes you don’t want to be tied to your computer when doing so. There are a number of reasons why connecting via USB is not always the best solution:

The solution to this is pretty simple. All you need are 2 commands and a WiFi network where your laptop and your Android device can see each other.

  1. Make sure your device is connected via USB (don’t worry, we can remove the cable shortly). Then type in your console: adb tcpip 5555

  2. Find out the IP address or hostname of your Android device, then connect to it. for example: adb connect pixel-6 or adb connect 192.168.x.y

That’s it - you’re done!

$ adb tcpip 5555
restarting in TCP mode port: 5555
$ adb connect pixel-6
connected to pixel-6:5555

You can now use all adb features like logcat, install, chrome://inspect, etc. as long as you are in your WiFi range. This will work until you reboot your Android device. For a persistent solution, please visit the linked Stack Overflow thread. The persistent solution requires a rooted Android device, though.

Happy Coding!

Resources

Disable CSS Transitions in RSpec ❯
Netskin Logo