Appcelerator Blog

The Leading Resource for All Things Mobile

Speed up your Android Emulator!

1 Flares 1 Flares ×

Today’s guest blog post comes to you by the folks at JoliCode, a software development firm in France specializing in Titanium, Symfony2 and JavaScript.” Earlier this year we published an article on how to use x86 images with your Android Emulator. Today we revisit this topic with a much more streamlined process that you can implement in just a couple minutes.


If you develop applications for iOS and Android, you probably have used the iPhone Simulator and the Android Emulator. There is no real issue with the iPhone simulator, but Google one is very, very, very slow. It is so painful to debug with it that if you develop on Appcelerator’s JavaScript-based Titanium SDK, you only use the iPhone Simulator every time, except when you want to test something specific on Android.

The Android Emulator is based on QEMU (the Quick EMUlator) which emulates an ARM processor on your computer which has a x86 processor. I surely don’t need to explain why emulate a processor by a software isn’t a very good idea if you want something reactive and usable. Furthermore, other hardware features are also emulated by the software. All those things combined plus the fact that smartphones have some very powerful chipsets lead to a very slow emulator.

Ok, but what can I do about it?

First thing to do is to launch the Android SDK Manager, go to your Android SDK’s installation folder, and type:

$ ./tools/android

You can see that there is an “Intel x86 Atom System Image” available for Android 4.2.2, 4.1.2, 4.0.3 and 2.3.3. Select the versions you want to test and install them. If you scroll at the bottom of this screen, you’ll see an “Extras” folder, expand it and select the “Intel x86 emulator accelerator (HAXM)” to download it. You have to install it. To do so, go to your Android SDK’s installation folder, then go to extras/intel/Hardware_Accelerated_Execution_Manager/ and execute IntelHAXM.dmg.

Now that you have installed everything, you need to configure your devices, just use the “Tools” menu to launch Android Virtual Device Manager (AVD Manager). There’s a list with all your devices, just create a new one. If you select a target that has an x86 image (let’s try with Android 4.2.2), you should be able to switch the CPU/ABI to “Intel Atom (x86)”. This configuration with the HAXM driver, easily installed, will let you run a faster emulator. We can go further! Edit the device configuration and check the “Use GPU Host” in the “Emulation options” section, it will allow the emulator to use the computer GPU instead of emulating one.

Ok, our device is ready. Just test it.

$ ./tools/emulator -avd Test_for_fast_emulator -wipe-data -no-boot-anim -cpu-delay 0
$ ./platform-tools/adb install ../Test/build/android/bin/app.apk

YEAHYYY! It’s fast!

How do I do this with Titanium Studio?

If you use Titanium Studio, you can configure the Android Emulator to use the x86 image too.

Click on ‘Run Configurations”, select the project you’re working on and then choose the version of Android you want to test with the label “x86”:

Launch the Emulator, it should be faster, but not as fast as the one we’ve created using the AVD Manager because we didn’t select the option to use the GPU host. Launch the AVD Manager, you’ll see a new device which use a x86 CPU. Edit it.

You can see an Hardware section, click on “New”, select the “GPU emulation” property, and then switch its value to “yes”, save, relaunch your emulator, and there it is, fast and usable!

Protips©: In the Hardware section, also add the “Keyboard support” property, and set its value to “yes”, save, and relaunch the emulator, you’ll be able to use your keyboard to fill some form, or whatever!

Please note…

Don’t forget… you have to test your application on several real devices to ensure that the app works properly on different screen sizes, or hardware. Keep in mind that smartphones have less bandwidth, or less battery than your computer.

1 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 1 Email -- 1 Flares ×

10 Comments

  1. Cody

    I don’t suppose there’s a way to do this with the Google APIs, is there?

  2. Steve S.

    Is there any way to get the x86 CPU enabled for Google API versions of the Android SDK’s?

    Both Kitchen Sink as well as my own app won’t install properly without them.

  3. Shaman

    I cannot get this to work because of Google API not present in x86 version. Any hint?

  4. João Serra

    Too bad this won’t work with google’s api. By default the emulators that my titanium created already had this configuration

  5. Thanks for this Ricardo – very useful. When I have a few minutes I’ll give it a go. But the question must be asked (of Google) as to why their Emulator has been causing developers huge frustration for so long, whereas Apple’s ‘just works’ with no jiggery-pokery? It is not a good advert for those starting on Android development.

  6. Adam

    When will support for Genymotion Android VM be available? It’s faster then the ios simulator!

    • Ricardo Alcocer

      You CAN use Genymotion with Titanium as it has full ADB support. Simply launch your VM from Genymotion and use the command line to install your app via adb, for example: adb install c:example.apk. There are basic guides here (https://cloud.genymotion.com/page/doc/). You could also read thig blog post, or read about official support coming in 3.2.

      R

  7. Ricardo Alcocer

    @João

    There seems to be a solution to this (at least for maps), although I haven’t tried it myself | http://stackoverflow.com/questions/9857325/google-maps-sdk-with-new-intel-atom-x86-emulator/10540106#10540106

  8. Follow this if you want an usable Android x86 emulator (with Google APIs):

    http://codebutler.com/2012/10/10/configuring-a-usable-android-emulator/

  9. Alex

    Be cautious when running HAXM as it will freeze your system if you’re running Mavericks. Make sure you have the latest Intel hotfix otherwise you’ll run into issues.

Comments are closed.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
1 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 1 Email -- 1 Flares ×