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.
– 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.
– 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”.
– 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.
– Now just run your machine and play around with the device, compare it with the standard emulator and see how fast it is :)
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.
– 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
– 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.
– Select your device and click “OK”.
– That’s it, you should see your app running on your brand new emulator ;)
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.
– If you want to use the Android back physical button, hit “Esc”
– If you want to use the Android menu physical button, hit “F1”