Xamarin utilizes the Android Debug Bridge (ADB) for debugging on physical devices, which are usually connected over usb. While this feature definitely is useful, it would sometimes be more practical if you could do this over WIFI instead.
Luckily, that is possible! You can simple switch between using USB and TCP/IP for debugging. To get started, you need to connect your device via USB to the computer you’re debugging from. I’m using Windows, so the commands I’ll execute the following commands from the commandline (which runs as an administrator), but since they are adb commands, they should be the same on Linux or macOS.
The first command to switch from USB to TCP/IP is adb tcpip . Replace with anything you like, I’ll use the same as Xamarin suggests in their documentation, which is 5555. After this is done, you’ll want to connect adb to your device. To do this, you need its IP address, which can be discovered by going to Settings - WIFI - More (the dots-symbol in the upper right corner) - Advanced.
After you obtained the IP, connect to the device using adb connect :. After this step, you can disconnect the device from USB. When using adb devices, this should now list a device at the matching IP address. Visual Studio will now also display the devices IP address in the debugging window.
To switch back from WIFI to USB, simply use adb usb.
Since this is all based on ADB, debugging over WIFI is not restricted to use with Xamarin & Visual Studio. You can also use this for regular Android apps that are developed with Android Studio!