Using Xamarin Android Player Through Parallels

For Xamarin developers, getting an Android emulator working is a commonly faced challenge since the standard one provided by Google is unworkably slow. When different operating systems and virtual machines are in the equation as well, the potential for encountering problems obviously increases. It is a common scenario however, and is how I prefer to work. More specifically, where possible I develop in Visual Studio inside a Windows virtual machine using Parallels, with Mac OS as the host providing access to the iOS emulator and build host. This allows me to use the IDE I already use on a daily basis when I am not on a mobile project, while also being able to run iOS, Android and Windows Phone emulators all on the one machine.

There is some information out there describing how to get GenyMotion working in such cross-platform environments, which uses the same Oracle VirtualBox technology as the newly launched Xamarin Android Player (XAP) under the covers. However, it is a little inconsistent and often involves some sort of complicated SSH tunnelling. So my grand plan was to document this entire process from end-to-end specifically for XAP since Xamarin did not document this initially. That is … until I was almost there after doing the crazy SSH tunnelling myself … I discovered a new blog post by Xamarin’s James Montemagno on the subject!

Newer versions of XAP make it easier still. Now all you need to do is to get the IP Address by clicking on the settings cog wheel in your XAP. In my case, it is 10.71.34.101.
Xamarin Android Player - IP Address

Then, all you need to do is open an ‘Android Adb Command Prompt’ from Visual Studio and enter adb connect. You can also enter adb devices to check your connection status if you wish.

Xamarin Android Player - adb connect

Note that however, you will still need to enable ‘USB debugging mode‘ to allow the Visual Studio debugger to do its thing. For those who don’t know the secret Android developer handshake … on your emulated Android device:

1. Go to Settings
2. Go to About phone
3. Click on Build number seven times

Hope that helps! And a big thank you to James and the Xamarin team for saving me from having to do the aforementioned crazy SSH tunnelling! 🙂

Links

Updated: 17 March, 2015