Home > Tips > Android emulator is too slow. And here’s the solution…

Android emulator is too slow. And here’s the solution…

Why can’t we have nice things?

I’m an iOS developer, and anyone else who worked with iOS knows that iOS Simulator is awesome. Fast, reliable and pretty. Sure, sometimes it doesn’t work very well, but it’s pretty close to perfect. I would add some other features, such as, using your Mac’s iSight as a camera for the simulator. -Apple? Please?-

Needless to say that to someone who it’s used to work with iOS Simulator, the Android Emulator is a *very* big disappointment. But why is the Android Emulator so bad compared to the iOS Simulator?

Emulator vs Simulator

The terminology is: Simulator is a system that behaves similar to something else, but the implementation it’s not necessary the same. An Emulator in the other hand, is a system that behaves exactly like something else. Basically:

- iOS Simulator: Runs native code on you Mac, compiled for x86 architecture.

- Android Emulator: uses QEMU to run ARM, emulating the hardware.

Click here for an interesting reading about the subject.

Enters AndroVM

You can improve the experience using AndroVM and VirtualBox. In a nutshell, AndroVM is a VirtualBox Android image ready to use, and works pretty well ;)

- First open AndroVM download page clicking here and download androVM_vbox86p_4.1.1_r6.1-20130222-gapps-houdini-flash.ova file. (if you want the tablet version, download the vboxtp version.

- Download and install VirtualBox for your system clicking here.

- On VirtualBox, go to File -> Import and select the .ova file you just downloaded.

Import .ova

- I like to clone the image, so I can mess around with the system without any problems, so, right-click on the virtual machine and select “clone” and when prompted, select “full clone”.

clone

- Right click on the image, click on Settings. Open the Network tab, click on Adapter 1, check the “Enable Network Adapter” and attach to your adapter. This is for “adb” to connect to your virtual box image.

adapter

- Now just run your machine and play around with the device, compare it with the standard emulator and see how fast it is :)

android

How to debug your application

Now that you have your VirtualBox setup, it’s time to actually use it to debug your apps. First, on your Android Emulator, open the AndroVM app. It should be the lower left icon on your device screen. You should see the device network IP there.

androidIP

- Open your eclipse project, for this example, I just created a standard “Hello World” project.

- Open the “Run Configurations” panel, click on “Target” tab. Select to “Always prompt to pick device”.

- Run your project, you should see this screen

eclipsePrompt

- Now, open your terminal, and type “adb connect THE_IP_OF_YOUR_DEVICE”

- After doing that, note that the Eclipse prompt now shows your device on the list.

eclipseDevice

- Select your device and click “OK”.

- That’s it, you should see your app running on your brand new emulator ;)

androidTest

Conclusion

This is definitely not as fast as the iOS Simulator but it’s a huge step forward. With this setup you don’t need to always have thousands of devices with you neither wait hours to have the emulator to boot up.

ps.

- If you want to use the Android back physical button, hit “Esc”

- If you want to use the Android menu physical button, hit “F1″

Enjoy :)

About these ads
  1. charx
    December 2, 2013 at 1:44 PM

    I think http://www.genymotion.com has the same solution out of the box. Nevertheless, nice post ;)

    • December 2, 2013 at 7:12 PM

      Yes, Genymotion is the comercial version of AndroVM.
      AndroVM is free, but probably have it’s days counted, but it’s a good solution for the moment.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 151 other followers

%d bloggers like this: