I discovered this little trick a year ago and it was immensely helpful. So far, whenever I was working on my Android apps, I had to connect it to my laptop with a USB cable. The USB cable is annoying and limits my movements. Consequently, I was researching, if there is an option to do the debugging over WiFi.
Luckily, there is a super simple way! All you need is a USB cable (for the initial setup) and have both devices in the same network. The screenshots in the following section are from my Windows PC, but it works on any operating system.
adb tcpip 5555
adb connect <IP address of your device>:5555
adb devicesagain, you should see your device.
Now you can execute adb commands or use your favorite IDE for android development – wireless!
Now you might ask, what do I have to do when I move into a different work space and change WiFi networks? You do not have to repeat steps 1 to 3 (these set your phone into wifi-debug mode). You do have to connect to your phone again by executing steps 4 to 6.
Unfortenately, the android phones lose the wifi-debug mode when restarting. Thus, if your battery died, you have to start over. Otherwise, if you keep an eye on your battery and do not restart your phone, you can live without a cable for weeks!
Happy wireless coding!