HotReload With Wi-Fi Debugging Gives More Power To Xamarin Forms
Wi-Fi debugging is another way to deploy and debug your application in Android and iOS devices. A couple of months back Microsoft released Xamarin HotReload for continuous changing of the values in the editor. It will instantly reflect in your running device without the need to rebuild and restart the application. Now, we going to check how HotReload and Wi-Fi deployment work at the same time. Before starting this, we need to configure our IDE and mobile for Wi-Fi debugging.
Configure iOS
Open XCode and navigate to Window menu >> select Device and Simulator >> check to Connect via Network checkbox as shown in the below image.
Note: Your iPhone and Mac must be in the same network connection.
Go back to Visual Studio and select dropdown device list. Wi-Fi connected devices will be shown with a small Wi-Fi icon in front of the device name.
Now select the iPhone.
Configure Android
Open Terminal in Mac and run the following commands for adding the adb path.
echo 'export PATH=$PATH:/Users/*thisismyaccount*/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
source ~/.bash_profile
Note: first connect your android device via USB.
After adding the path, enter the below command.
adb devices
Next, execute the TCP command to have the adb listen to the network port to connect a device.
adb tcpip 5555
Copy your Wi-Fi IP from your Android device by doing>> Settings >> Wi-Fi >> Connected Wi-Fi settings >> note the IP address.
Next, connect your adb to an IP address by running the below command.
adb connect 192.165.12.1
The device connection is established successfully. Unplug your USB and deploy your application over the Wi-Fi. After unplugging the USB this IP device will be shown your ide drop-down list, and select and deploy it
After debugging change the adb listen port to USB mode by executing the below command.
adb usb
HotReload
Enable your HotReload by going to Visual Studio Preferences >> Xamarin Hot Reload left menu and check the Enable Hot Reload checkbox.
Now check your HotReload, set your startup project and run the application. You can edit the values and Save it, instantly your application will flash and load into a newly changed design.
That was awesome, thanks to the Xamarin Forms Team.
Engineer | Microsoft MVP