Updated on August 19, 2015
Get rid of cables and Remote Debug your Android device!
Cables are a companion of our everyday life but a necessary evil. I personally avoid using them wherever it is possible and even charge my phone wireless. As a mobile developer you always have a bunch of cables in you bag but the time may come where we do not need them anymore. Remote Debugging could be one step into this direction.
Since Android Lollypop it is possible to deploy your apps via Wifi to your device and debug them there. It can look like magic, when your phone gets remote controlled and states app by his own but is is definately not.
Important: To archive this, your development machine and Android device need to be in the same local network, of course!
Prepare your phone
To enable Remote Debugging on your phone, you need at least Android 5.0. Go to Settings, select Developer Options and enable the Android Debugging and ADB over network options. That’s it! All you need to do is remember the displayed IP Address, we will need it later.
Setup your PC
Using a Windows Machine you first have to add the location of your Android Platform Tools to the
PATH environment variable. These platform tools come with the Android SDK so the path to add ususally looks like this
C:\Program Files (x86)\Android\android-sdk\platform-tools.
Afterwards you should be able to access the ADB via command line. To test this, you can simply type
adb version. If this works you can connect your device by hitting
adb connect followed by the IP Address that your device displayes inside the debug options.
Now you are ready to debug over network and should now see your device listed in the debug target selection of your development environment. Have fun debugging you apps on a real device without any cables and remember to switch debugging off at your phone when you are finished. Otherwise it will kill your battery.