Over a million developers have joined DZone.

Increasing the Performance of Your Android Emulator

· Performance Zone

Download Forrester’s “Vendor Landscape, Application Performance Management” report that examines the evolving role of APM as a key driver of customer satisfaction and business success, brought to you in partnership with BMC.

One core difference between Android and iOS devices is the variety of devices on which the respective operating systems run. iOS developers need only cater to a very small number of devices, with specific screen sizes and resolutions. On the other hand, Android developers have to cater to hundreds of different devices with various screen sizes and different hardware specifications.

For independent developers and hobbyists, it is not feasible to purchase every possible device out there which runs Android. For this reason, the Android emulator was created to simulate these devices. However, many developers have complained that developing on an emulator is extremely frustrating, slow, and in some cases, simply unusable.

Enter Intel’s x86 Emulator Accelerator Manager (HAXM)! This technology allows developers to run an emulator which performs much faster than a typical emulator running on an ARM-based CPU architecture. It should be noted that this technology only works on Intel VT (Virtualization Technology) enabled systems. As a general improvement, you can also enable your emulator to use your machine’s GPU, which should make rendering of animations or graphics much faster than it would otherwise be.

Windows and Mac users can download Intel’s HAXM straight through the Android SDK Manager under the “extras” section. The installation can then be found at:

%ANDROID_HOME%\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe

IntelHAXM

Linux users can install HAXM by following the instructions here. For those of you running Linux, you need to be running a 64-bit version of the OS in order to make this work.

After you have installed the HAXM, create a new AVD which runs on an Intel Atom CPU architecture.

NewAVD

After having done this, simply launch the AVD you have just created. On a PC running Linux with an i7 CPU and an Intel Integrated Graphics Card, the emulator above finished loading in less than three seconds. A significant improvement over the previous time of two minutes!

It should be noted that there is a bug present when you use API Level 17 in combination with the Intel HAXM which involves flooding your logs with garbage text. Google has yet to release a fix for this. At the moment, there are currently two known workarounds:

  • Use an API level of 16 or less
  • Set the following RegEx as a filter in the logcat view:
    ^(?!.*(nativeGetEnabledTags)).*$

Enjoy!

See Forrester’s Report, “Vendor Landscape, Application Performance Management” to identify the right vendor to help IT deliver better service at a lower cost, brought to you in partnership with BMC.

Topics:

Published at DZone with permission of Justin Saliba , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}