IntroductionThe “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).
DisplayBeginning 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.
Software OpenGLWe 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.
Hardware OpenGLBeginning 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″.
KeyboardBy 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
StorageThe VM on ICS (4.0.x) comes with 2 virtual hard disks :
- one with the android system (boot, /system, /data, …)
- one with sdcard
The VM on JB (4.1.x) comes with 3 virtual hard disks :
- one with the android system (boot, /system, …)
- one for the /data android directory
- one with sdcard
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.
NetworkingThe 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
To use the eth0 management connection, you have to configure the first network card of your VM as a “host only network” and attach it to a DHCP-enabled network – if you don’t have such a network in your VirtualBox configuration, you can create one (go to the general ‘File’ menu, then ‘Parameters’ and ‘Network’).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/”
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 unlockTo unlock screen, press the “Home” key and then slide with your mouse.
You can disable screen lock in the Settings (“Development->Always stay awake”).
Configuration tutorialHere 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.
Network AdapterTo 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.
Importing VMNow, 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.
AndroVMplayerThe 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.
To download, click the link below: