Tuesday, June 25, 2013

Using x86 Android VM instead of ADT emulator

I have been trying to learn how to develop Android applications in my free time.  I have started the activity many times but never got very far each time.  One of the reasons is how slow it is to load the Android Developer Toolkit device emulator.  It seems to take forever to load and just as long to test the program.

I recently ran into a project called AndroVM (I think it now is a commercial product so I don't know if you can still get it for free).  This contains an Android x86 virtual machine that runs Android 4.1 (Jelly-Bean?). It runs real fast and nearly any application you can download from the Google Play Store works in this environment.  

The AndroVM is to be used with Oracle's VirtualBox free software.  There are instructions on how to install it and here they are <insert URL here>.  

In order to use the AndroVM you must start it and the Eclipse ADT.  The order is not important.  What is important is determining the IP address of the Android VM and connecting it to the ADT.  This is done by installing the Terminal Emulator from the Google Play Store.  This gives you a command line interface to the Android OS.  The command netcfg will show the IP address you need.  Here is an example:


The IP address of eth1 (this is the ethernet port of the NAT'd address) and this is the one we need to run a command in a Linux terminal.  I am not sure why a Bridged and a NAT'd ethernet devices are needed but both are for some reason otherwise the virtual machine is unable to connect to anything.

Open up a Linux terminal and switch to the sdk/platform-tools sub-directory of the location the ADT bundle file was uncompressed into.  Run the following command to connect the Eclipse ADT to the AndroVM device:


Now all you need to do is run your Android application from the Eclipse ADT and it should load and run in the AndroVM instance.  I am impressed on how fast apps load and run in the virtual machine.  So much faster than the ADT emulator.

Here are some other adb commands that I need to investigate:

adb shell
adb kill-server

July 8, 2013: Here is a where you can download Android 4.2:

https://code.google.com/p/android-x86/downloads/list

Here is a web site that has some directions on how to install under VirtualBox:

http://xmodulo.com/2013/05/how-to-install-and-run-android-x86-on-virtualbox.html