Skip to main content

Running Android in a virtual machine




 




Introduction

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).

Description

Display

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.

Software OpenGL

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.

Hardware OpenGL

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″.

Keyboard

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

Storage

The 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
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.

Networking

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
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.

Installation


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”).

Configuration tutorial

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.

Network Adapter

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”.
Step 1 - VBox Network Preferences
Don’t forget to enable DHCP Server for this network adapter.
Step 2 - Host Only Adapter Configuration

Importing VM

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.
Step 3 - Importing OVA

Setting-up VM

Step 4 - VM Parameters
By default, AndroVM has its first network adapter set to disable. Go to the VM network settings and set it to “Host Only Adapter”
Step 5 - Network Adapter 1
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.
Step 6 - AndroVM Config
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.
Spet 7 - VM Reboot
The VM will stay in that state. Now it’s time to run the AndroVMplayer.

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]
Step 8 - AndroVMplayer
Wait a few seconds, and the Android boot animation will appear in the AndroVMplayer.




 To download, click the link below:

Comments

Popular posts from this blog

CDAC CCAT Rank - Which Centre you Should go for...

Subscribe us for our YouTube channel and any kind of help Click here to ask questions regarding CDAC 1. C-DAC (Head Quarters) Pune    CDAC's Admission Booklet- Process of Admission to Post Graduate Diploma Courses of C-DAC                         click below to know about the CCAT's This batch allotment                click above to know about the CCAT's This batch allotment Rank 1-300 c-dac HQ has been the best from the start. 2.  Sunbeam Pune Rank 300-500 I got very positive feedback from my friends who are in c-dac banglure main campus,since there are many companies you may get more opportunities. 3.  C-DAC Knowledge Park Rank 400-700 It as very good faculty .Almost all the students get placed here every year. 4. C-DAC Hyderabad Rank 200-1000 (It depends on the course which you select) C-DAC hyderabad is very good for the course PG-DESD. PG-DESD course is in hyderbad is better than pune HQ as per the past feedback.It as v

CDAC COURSES AND PLACEMENTS, WHICH IS BETTER FOR YOU

Subscribe us for our YouTube channel and any kind of help   Click here to ask questions regarding CDAC Before going through this post, I would like to draw your attention towards the importance of this post. This page not only explains my experience in CDAC but also aims at answering the queries of you all who are going or looking to have a course from CDAC. Kindly post your queries at the bottom of this page and we will get back to you within 24 hours. Kindly do not post your queries as an Anonymous user and do not forget to subscribe via email so as to keep track of your query.                         click below to know about the CCAT's This batch allotment                 click below to know about the CCAT's This batch allotment ______________________________________________ NOW a day lot of the graduates and post graduates are wondering most of the times on which course they should go for. What are the pros & cons of joining a particular ce

Placement Statistics - 2011 & 2012

Subscribe us for our YouTube channel and any kind of help                          Post your queries below and we will get back to you in no more than 24 hours.  Click here to ask questions regarding CDAC                         click below to know about the CCAT's This batch allotment                     click above to know about the CCAT's This batch allotment CDAC's Admission Booklet- Process of Admission to Post Graduate Diploma Courses of C-DAC Click here to see placement statistics About C-CAT, Exam Pattern and Books No. of Seats Across Various Training Centres Important Dates - 2014 Tags: CDAC, CDAC scope in future, CDAC placements, CDAC training, CDAC recruitment, CDAC training centres, DSSD, DESD, DAC, PGDSSD, PGDESD, PGDAC, DABC, PGDABC, VLSI, PGDITISS, PGDIVESD, PGDESD, PGDWiMC, placement statistics