This guide introduces Genymotion and hardware acceleration as alternatives to the Google Android Emulator, and demonstrates installation and setup.
Out of the box, the Google Android Emulators are prohibitively slow, to the point of being near unusable. Several technologies are available to significantly speed them up so that they can be used effectively. Two of the most popular of these technologies are:
- GenyMotion - Genymotion provides a virtual Android environment built on top of VirtualBox, a generic x86 hardware virtualization system. A version is available free for personal use. Advanced features are available in the Indie and Business licenses.
- Intel HAXM Drivers - The Intel HAXM Drivers provide hardware acceleration for x86 based emulators on Intel VT-enabled sytems. The HAXM drivers are free to use and published by Intel.
This guide covers setup for both Genymotion and HAXM emulators.
Setting Up GenyMotion as Your Android Emulator
- To get started, download VirtualBox and run the installer.
Follow the instructions presented by the VirtualBox installer. On Windows, please note it will disrupt your network connection while it installs network drivers. On Mac OS X, you will want to restart after installing VirtualBox before proceeding.
- Register at Genymotion and download the appropriate installer for your platform.
On OS X, mount the .dmg download and install Genymotion by dragging Genymotion and the Genymotion Shell to your application directory. On Windows, run the installer and proceed through the dialogs:
- Run Genymotion and log in with your Genymotion account to access the list of pre-configured devices. Pick your desired Android version or device and start downloading the device image.
After you have a device downloaded and ready, click the Play icon. Depending on your system, the virtual device will boot up in a few seconds.
Note: Genymotion currently offers only one KitKat (Android 4.4) device, a 10-inch tablet. If you are deploying to a device running an earlier Android version, you will need to make sure to adjust the Minimum Android version accordingly in your project (Project Properties > Android Application).
Select a device configuration to download from the Genymotion library:
Make sure your Minimum Android Version matches with the Genymotion device you are running:
From Xamarin Studio, deploy your project and pick the Genymotion emulator as the target. Deploy from Xamarin Studio by selecting the running Genymotion emulator from the device list:
Note: Genymotion uses VirtualBox under the hood, and VirtualBox has its own hypervisor. If you are using the Hyper-V hypervisor (for Windows Phone emulation, for instance), these two will not be able to run simultaneously. One way of ensuring the VirtualBox hypervisor can run is to start Windows without Hyper-V when you plan to use Genymotion. For details on this approach, check out Scott Hansleman's post on cloning your boot configuration with Hyper-V disabled.
Setting Up Your Google Android Emulator with the Intel Hardware Accelerated Execution Manager (HAXM)
- Launch Xamarin Studio.
From the Tools menu, choose Android SDK Manager, as illustrated by the screenshot below:
In the SDK Manager, make sure you have installed the x86 Atom System Image for the desired Android SDK version. If needed, select it and install the package, agreeing to the license as needed. The image will download and install:
At this point, you can build x86 Android Virtual Device versions by selecting the appropriate CPU/ABI choice when creating the device, but they will not be accelerated. If you have any Android Virtual Devices running, close them before continuing.
- From the Intel website, download the latest HAXM virtualization engine. If you are running Mac OS X 10.9 Mavericks or Windows 8.1, you will want the appropriate hotfix version that corrects issues on these systems. While the links appear to have been temporarily removed, they are still accessible directly from the original links: HAXM hotfix for OS X 10.9 and HAXM hotfix for Windows 8.1.
Install the HAXM engine, following along with the dialogs:
If you haven't already created an x86 Android Virtual Device, do so now from the Android Virtual Device Manager. This is accessible in Xamarin Studio from the Tools menu by selecting Open Android Emulator Manager. Use the following template to create an x86 Android Virtual Device:
- After you have a device defined, in the Virtual Device Manager, select it and click Start. Adjust any launch options and Launch it. After several seconds, your accelerated Android Virtual Device will be running.
From Xamarin Studio, deploy your project and pick your new x86 emulator device as the target:
If using Xamarin Studio, set the project to support x86 by selecting the x86 checkbox under Options > Build > Android Build > Advanced, as illustrated by the screenshot below:
6. If using Visual Studio, set the project to support x86 by selecting the x86 checkbox under Project > Properties > Application > Supported Architectures, as shown below:
Note: HAXM run simultaneously with VirtualBox can cause stability issues. Both can exist together on the same machine, but it is best not to run both Genymotion- and HAXM-based emulators at the same time.
This guide covered the proper installation and setup procedures for using Genymotion and hardware accelerated emulators with Xamarin.