When developing for Android using physical test devices it can become frustrating to constantly have a device (or more) constantly hanging from your machine. This becomes even more obvious when developing for devices such as Android TV where users are generally 10ft away from the device / screen. I’ve started using adb
(Android Debugging Bridge) more and more often to resolve this issue.
To connect to a device over Wi-Fi (wireless) use the following steps:
Connect your device via USB and verify it’s connected properly:
You should see device
listed as a status if you’re successfully connected.
$ adb devices List of devices attached unique_device_identifier device |
Set your adb tcpip port:
The default port is 5555. If you’re already using that port, specify an available port.
$ adb tcpip 5555 |
Disconnect the device from USB
Disconnect the device from USB before proceeding to the next step.
Using adb connect to the device using it’s IP addres
Find the local network IP address of your device. This can usually be found by looking at either the Wi-Fi or about settings (depending on the make, model and android version of the device). If you’re not using port 5555 (see step above) specify the port number after the IP address (ie: X.X.X.X:1234).
$ adb connect 192.168.1.X connected to 192.168.1.108:5555 $ adb devices List of devices attached 192.168.1.X:5555 device |
Success! You can now execute adb
commands without a USB cable! If you run into trouble you can always try restarting the adb
and trying from the first step again.
$ adb kill-server $ adb start-server |