Mobile Zone is brought to you in partnership with:

Justin is responsible for designing prototypes and proofs of concepts for in-house projects, some of which include using the APIs of the Android operating system. He's also experienced with MuleSoft support, training materials creation and testing of Cloud Connectors for Mule. Here's his full bio Justin is a DZone MVB and is not an employee of DZone and has posted 4 posts at DZone. You can read more from them at their website. View Full User Profile

Increasing the Performance of Your Android Emulator

10.10.2013
| 8734 views |
  • submit to reddit

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!

Published at DZone with permission of Justin Saliba, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)