One of the key parts of productive development is having the right development environment, and using Genymotion with Xamarin for Android is a fantastic.
Having done a fair bit of Android work beforehand I know only too well how painful it is working with the Android emulator provided with the Android SDK. Its really slow and very temperamental…I’d say out of all the main emulators (iOS. Windows and Android), that the Android one is the worst.
That’s why I opted for something different!
I’ve used Genymotion on previous Android projects and have to say its a pleasure to work with. It runs using Virtual Box, and provides the best option for debugging and testing your Android apps on a desktop computer. And it works beautifully with Xamarin and Visual Studio!
To make the case even more compelling, the non-commercial version of Genymotion is totally free, and the indie licence is only €99. At €99 Genymotion will easily pay for itself in time saved waiting for the Android emulator!
Getting Started with Genymotion
This guide is deliberately brief because working getting started with Genymotion is a piece of cake. I did think it was worth documenting my steps though!
Setting up Genymotion is pretty much as simple as running the installer – everything is taken care of and it just works. I’d write it up more fully but its really that straight forward!
I should note that you do need to install Virtual Box beforehand. There are also some issues using Virtual Box and Hyper-V at the same time but Scott Hanselman has written an article about dealing with Virtual Box and Hyper-V.
Creating a New Virtual Device
Once you’ve got everything installed you just need to launch up Genymotion and you should get a screen something like this:
You’ll want to add a new virtual device so press the “Add” button. This next screen should show you a list of available devices. If it doesn’t you should get a prompt to connect using your account to Genymotion online – simply doing this should bring up the list of devices.
Here you can filter by Android version and device model – I wanted a fairly standard and well used device so I chose the “Google Nexus 5”. Once you’ve selected your device, just click “Next”, where you’ll be prompted to give it a name (I just left mine as the name provided):
At this stage Genymotion will start downloading the device – the rough download size for my selection was 209mb. Once the download is complete you should get a confirmation box, where you can just press the “Finish” button.
Now your Genymotion main screen should show the device you’ve downloaded:
Just select the device and click the “Play” button – this will initialize the device, and spin up Android on it. It may take a minute but believe me its a hell of a lot quicker than the standard emulator!! Once its loaded you should have a fully usable Android VM:
Debugging on the Genymotion VM
I thought I’d just wrap up by quickly going over how you debug your app on the Genymotion VM. Its amazingly simple with Xamarin and Visual Studio!
I just created a sample project called CodenutzComics using the “Blank App (Xamarin.Forms.Portable)” template. Once everything was created I chose the Android project (CodenutzComics.Android) and set it as the start-up project. Notice on the image below how Xamarin and Visual Studio have automatically recognised the Genymotion VM running:
This means that I’m ready to go and that the debugging should work seamlessly. Now I just choose “Start Debugging” (or press F5), and the project will be built and deployed onto the Genymotion VM automatically.
All in all this is really impressive, from the ease of installing Genymotion to how simple it was to debug the Xamarin app straight from Visual Studio on the Genymotion VM.
I have to say that Genymotion is a huge leap forward over the standard Android VM and is well worth the €99 (or free for personal use). If you’re doing Android development, whether it be with Xamarin, Android Studio or Eclipse, just go get Genymotion now, you won’t regret it!