Você está na página 1de 6

Accelerating Android Emulators with HAXM

Overview
Out of the box, the Google Android Emulators are prohibitively slow, to the point of being near unusable. As such,
several technologies are available to significantly speed them up so that they can be used effectively. In general,
we support three techniques that you can use to improve Android emulation performance:
Xamarin Android Player Our new Xamarin Android Player runs with hardware-virtualization on your
Windows or Mac desktop to give your apps the shortest startup time and best possible performance
through hardware-virtualization and hardware-accelerated graphics. This is our recommended way to run
Android in a virtualized environment. For information about how to install and configure Xamarin Android
Player, see Xamarin Android Player.
Intel HAXM Drivers The Intel Hardware Accelerated Execution Manager (HAXM) Drivers provide
hardware acceleration for x86 based Android SDK emulators on Intel VT-enabled sytems. The HAXM
drivers, published by Intel, are free to use.
Note: Running HAXM simultaneously with VirtualBox (Xamarin Android Player uses VirtualBox) can cause
stability issues. Both can coexist on the same machine, but it is best not to run a HAXM-based emulator at the
same time as a VirtualBox emulator.
This guide provides detailed information about how to install and configure the Intel HAXM drivers to make the
Google Android Emulator run faster. If you plan to exclusively use the Google emulators, you should install these
drivers. However, you are strongly encouraged to use the Xamarin Android Player instead.

Setting Up Your Google Android Emulator with


HAXM
1. Launch Xamarin Studio.
2. From the Tools menu, choose Open Android SDK Manager:

3. 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.
4. 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.
5. Install the HAXM engine, following along with the dialogs:

6. If you haven't already created an x86 Android Virtual Device, do so now from the Android Virtual Device
Manager (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:

7. 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.
8. From Xamarin Studio, deploy your project and pick your new x86 emulator device as the target:

9. If you are using Xamarin Studio with Configuration: Debug selected, the ABIs list will be greyed out as
shown below and all options (including x86) will automatically be supported. If you are testing a Release
configuration, ensure that the x86 checkbox under Options > Build > Android Build > Advanced is ticked.

10. If you are using Visual Studio, set the project to support x86 by selecting the x86 checkbox under Project >
Properties > Application > Supported Architectures, as shown below:

Now your Android emulator will run much faster! For information about deploying your app to the emulator, see
Deploy and Launch an Application.

Using HAXM and Hyper-V


If you are using Microsoft Hyper-V on your Windows computer (for example, you use Hyper-V for Windows
Phone development and HAXM for Android development), you will be unable to use HAXM while Hyper-V is
enabled. Intel HAXM and Microft Hyper-V cannot both be active at the same time. Unfortunately, there is
currently no way to switch between between Hyper-V and HAXM without restarting your computer. However, you
can create a multi-boot configuration that allows you to pick which hardware virtualization to use at Windows boot
time. When Hyper-V is disabled, HAXM can be used.
Use the following steps to configure your Windows computer so you can selectively enable/disable Hyper-V at
Windows start time:
Open a command prompt with Administrator privileges and enter the following command:
bcdedit /copy {current} /d "No Hyper-V"
Use the GUID returned in the result of the previous command in this command:
bcdedit /set <GUID> hypervisorlaunchtype off

Where <GUID> is the GUID returned from the bcdedit /copy command. To illustrate, here is a screenshot of
a command session:

When you restart Windows, you will get a boot prompt that resembles the following screenshot:

Select the No Hyper-V option when you want to use HAXM. Select the other boot option when you want to use
Hyper-V.
To remove the No Hyper-V option from the boot menu, use the bcdedit /delete <GUID> command. For
example, the following command removes the No Hyper-V boot option created in the previous example:
bcdedit /delete {38f50265-1f62-11e4-802e-cee935cd4cce}

Summary
This guide explained how to improve Android emulation by installing and configuring the Intel Hardware
Accelerated Execution Manager (HAXM) to make the Google Android Emulator run faster.

Você também pode gostar