The “AndroVM” initiative aims at providing a “as good as possible” support to run Android in Virtual environments. It’s the follow-up of my previous work on Buildroid. Even if you used my previous VM, please read these instructions as many things may have changed (networking, storage, video, …).
The main objective of AndroVM is to provide Android developers a better way to test their software (better than the qemu emulator provided with the Android SDK).
Beginning with the 20121106 release, you can use “Software OpenGL” which uses the VirtualBox VGA driver for display or use “Hardware OpenGL” and use the “AndroVM player” external application for display.
We use the “UVesa” linux driver and a software-only OpenGL implementation.
The video resolution can be set through the “AndroVM Configuration” android application embedded in the VM.
Screen orientation change is supported : if an application rotates the screen, it will rotate automatically.
Beginning with the 20121106 release, Hardware OpenGL ES 2.0 support is included in AndroVM, thanks to the work done by Google. To use it you have to enable it in the “AndroVM configuration” Android app and install “AndroVM player” on your host.
Beginning with the 20130222 release, the TCP connections used to exchange OpenGL content are initiated from the host to the VM. Thus, it’s now possible to have multiple AndroVM running with Hardware OpenGL ; this way, we should also have less problems with firewall software running on the host.
An important thing is that, to use “Hardware OpenGL”, you have to configure the first virtual network card to be conntected to a “host only network” (see the network section hereunder). Beginning with the 20130208 release, the AndroVMplayer tool can now configure it for you : if the first virtual network card of the VM seems not correctly configured, AndroVMplayer will propose you to set it up for you.
When using Hardware OpenGL, the resolution and DPI are not set in the “AndroVM configuration” app but are supplied as parameters when you start “AndroVM player” : the first three parameters are : width, height, DPI. For exemple you would start “AndroVMplayer 1280 720 160″ to have a 1280×720 resolution with 160 DPI.
For Linux/Mac OS versions, you have to use the “run.sh” script to start AndroVMplayer, for example “run.sh 1280 720 160″, whereas on Windows, you directly start AndroVMplayer.exe, for example “AndroVMplayer 1280 720 160″.
By default, the system will use the hardware keyboard. But you can choose to disable it in order to use the Android virtual keyboard (this could be important for application testing). Keyboard configuration is done through the “AndroVM configuration” android application.
Some special (hardware) keys :
- To unlock screen, press the “Home” or “F1″ key
- The android “back” button is mapped to the physical “Esc” key
The VM on ICS (4.0.x) comes with 2 virtual hard disks :
- one with the android system (boot, /system, /data, …)
- one with sdcard
- one with the android system (boot, /system, …)
- one for the /data android directory
- one with sdcard
If you insert a USB stick and connect it to the VM (using VirtualBox) it will be mounted in /mnt/USB
Beginning with the 20130222 release, VirtualBox shared folders are supported ; all the “auto-mount” shared folders configured for the VM will be mounted in the “/mnt/shared” directory.
The AndroVM comes with 2 virtual Ethernet cards :
- The first one (eth0) is dedicated to ‘management’ but is, by default, configured as a “null connexion”
- The second one (eth1) is used by the system to emulate a Wifi connection
The “AndroVM Configuration” can be used to know the IP address used by the network management card (eth0). Then you can execute an “adb connect [IP]” and connect to your AndroVM (shell, push/pull files, …) and debug your application directly from Eclipse.
The AndroVM can be downloaded as an “OVA” file. Once dowloaded, you just have to import it in VirtualBox.
Please note AndroVM comes in 3 different versions :
- vbox86p : Built for a “phone”, 480×800 default resolution
- vbox86t : Built for a “tablet”, 1024×600 default resolution
- vbox86tp : Built for a “tablet” with phone capabilities, 1024×600 default resolution
Frequently Asked Questions
How can I install Google Apps (including the Market/Play app) ?
Here are the steps :
- Download Google Apps : gapps-jb-20121011-androvm.tgz [basically the /system directory from the Cyanogen gapps archive without the GoogleTTS app which crashes on AndroVM]
- Untar the gapps…tgz file on your host – you’ll have a system directory created
- Get the management IP address of your AndroVM (“AndroVM Configuration” tool) and do “adb connect x.y.z.t”
- do “adb root”
- reconnect with “adn connect x.y.z.t”
- do “adb remount”
- do “adb push system/ /system/”
Your VM will reboot and you should have google apps including Market/Play.
You won’t have some Google Apps, like Maps, but they can be downloaded from the Market/Play.
After one minute, the screen locks and I can’t unlock
To unlock screen, press the “Home” key and then slide with your mouse.
You can disable screen lock in the Settings (“Development->Always stay awake”).
Here is a small tutorial to help you setting-up AndroVM with hardware accelerated OpenGL rendering, using VirtualBox.
I will assume that you already have VirtualBox installed and working.
To run with hardware acceleration, as for using the ADB with AndroVM, you’ll need an “Host Only” network adapter. To create one, open VirtualBox, get to the “File” menu, “Preferences…”, “Network”.
Don’t forget to enable DHCP Server for this network adapter.
Now, you can import the VM into VirtualBox. Just double-click on the OVA file, or use “File” menu, “Import Appliance”.
It can be a good idea to rename the VM into something more friendly.
By default, AndroVM has its first network adapter set to disable. Go to the VM network settings and set it to “Host Only Adapter”
Then, start the VM. Now, you’ve got a fully functional software-rendered AndroVM. Now, open the AndroVM Config app, and check the box to enable hardware OpenGL.
Note that you might see the VM IP on the top off the app. This is the Management IP. You can adb connect this IP.
If there’s no IP address, then you won’t be able to use hardware OpenGL. Verify your host-only adapter configuration.
Click on the “Save” button, The VM will restart.
The VM will stay in that state. Now it’s time to run the AndroVMplayer.
The AndroVMplayer is a software used to display the VM content and manage its events. It won’t work if the VM is not running !
Open a command line interpreter, get to the AndroVMplayer directory, and type :
AndroVMplayer [width] [height] [density]
Wait a few seconds, and the Android boot animation will appear in the AndroVMplayer.
Step 8: the AndroVMplayer blocks on “waiting for connection from VM”
- If the VM shows a Management IP, try to connect to the VM through adb. If it doesn’t work, then turn off your firewall
- If the VM doesn’t show a Management IP, the your network adapter is not well configured