Page 1 of 1

Installing Android OS 2.2 on a Virtual Machine

#1 supercorey  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 119
  • View blog
  • Posts: 207
  • Joined: 15-February 09

Posted 08 October 2011 - 11:18 PM

*
POPULAR

How to Install Android OS on a Virtual Machine
By: supercorey

Hello, everybody. Today, I'll be teaching you how to install Android OS 2.2 on a Virtual Machine (VM) using VirtualBox. What could this be useful for? Well, having an Android VM effectively gives you an Android phone (without the physical device). You can use it to test apps you develop, try out the new Android OS (the steps should be similar to the ones in this guide for version 2.2), or even to try out the Android platform before you commit to buying it.

Firstly, we need to install the VirtualBox software. VirtualBox is a free program that "virtualizes" a system. It pretty much creates an isolated computer system inside of your currently running system(mind blowing, right?). You can download VirtualBox here. Once you have it downloaded, just run the installer and complete installation.

Your freshly installed copy (or possibly used, if you already had it installed) should look something like this:
Posted Image

Next thing we need to do is create the virtual machine. Click on "New" and a wizard will pop-up. Click "Next" and you will be presented with a screen prompting for a name and OS type. Use a name of your choice (I chose "Android OS 2.2"), and for OS type, select Operating System as Linux and Version as Other Linux so that the screen looks something like:
Posted Image

On the next screen, you will choose the amount of memory that the VM can use. A good amount for Android 2.2 to run on is 256MB, but you can use more if you really want. After clicking "Next", you will need to create a new virtual hard disk, so click "Next" once again to bring up the "Create New Virtual Hard Disk Wizard".
Posted Image

Proceeding to the next screen, you will be asked to decide between dynamically-expanding storage or fixed-size storage. I would suggest dynmically-expanding storage because, although it allows disk fragmentation to occur, possibly lowering speeds, it uses less disk space by making the virtual hard disk file larger only as more space is needed, not reserving all of the space at once. On the next page, you will be asked to chose the maximum size of the hard disk. You really only need 1GB at the very most, and not all of that space will be reserved at once since we are using dynamically-expanding storage. You can choose less, but I would suggest no less than 300MB. Click "Finish" on both of the windows currently open and a new VM will have been created! Your main screen should now look something like:


Now, you need to download the Android OS 2.2 LiveCD iso file. This is the media which will let us boot and install our Android 2.2 system. You can download it here.

With your iso downloaded and your VM selected in VirtualBox, open the "Settings" window. There's only a basic things we need to set-up here. Firstly, go under "Storage" and highlight the entry labeled "Empty":
Posted Image
Using the CD icon towards the right of the window, choose a virtual cd/dvd disk file, in this case, the iso you downloaded. Now, go under the "Network" section and change the "Attached To" combo-box to "Bridged Adapter". Under Name, select the name of your network adapter.
Posted Image
Click Ok to close this settings menu.

Now, it's time to boot our virtual machine! We'll have two paths we can take here: you can either install Android 2.2 to the hard disk to have persistant data, or you can boot it into LiveCD mode which allows you to use the OS without installation, obviously not storing any apps or other data you have.
Posted Image

To put it into LiveCD mode, just press Enter on the first option on the blue screen that comes up. After some commands fly accross the screen, you will be presented with a standard Android unlock screen. But, alas, you can't seem to interact with it! This has to do with how the VM handles controlling the mouse. To be able to use your mouse on things inside the VM, you will need to go to Machine->Disable Mouse Integration. Then once you click inside the VM, it will prompt you about capturing the mouse. This simply means that your mouse will be locked inside the VM until you press the Host key (by default Right Ctrl), and this is required. You now have a fully fuctional Android OS 2.2 VM, but what if you want to install it so you can have persistant data?

To install Android OS 2.2, when at the blue bootloader screen, select the last option, "Installation". You will be presented with the following screen:
Posted Image
Select "Create/Modify Partitions". This will prepare our virtual hard disk for installation. Choose New->Primary and accept the default size. Press Enter again to select "Bootable". Finally, move your cursor to Write and press Enter. Now it will want you to type out 'yes' to accept. On a real machine, partitioning can potentially destroy data, but since we are using a virtual machine, we have nothing to fear. Just type 'yes' and press Enter. Once it is done writing, go to Quit. Now we have a new entry on the menu called 'sda1'. Press Enter on it.
Posted Image
You will now need to format the new partition. Select 'ext3' and confirm it on the following screen. Once that finishes, you will be prompted to install GRUB. GRUB is a bootloader which is a program that is called on start-up and hands control over to the OS of choice (in this case Android OS 2.2). You will need to install GRUB or else your VM will not be able to boot. Finally, when it asks whether /system should be made read-write, you will need to decide. Making it read-write takes longer, but is generally required if you plan on using this VM for development, depending on what you are developing. If you are just planning on using the VM for non-development purposes, choose no, otherwise, choose yes. Once it finishes copying files to install, you will get a congratulations screen.
Posted Image
At this point, you can either proceed to run Android OS or you can create a virtual SD card. I would suggest creating an SD card since many apps rely on them.
If you chose to create an SD card, you will now need to specify the size. Choose anything you like, I commonly use 500MB even though that may be on the high side (or low side depending on what sort of usage you are planning for this VM). Just gauge it based on what you think you will need. It is always better to miss on the high side. Once the SD card has been created, you will need to reboot. First, go to Devices->CD/DVD Devices->Remove disk from virtual drive. This prevents the VM from trying to boot from the iso again, so that it instead boots from its installed hard disk. Then press Enter. The machine will reboot and bring you to a lock screen much like before.

Now, you know how to create an Android OS 2.2 Virtual Machine with VirtualBox. You can use this for development, personal use, or any other thing you can use a normal Android mobile device for. Have fun, post replies, and please don't distribute this tutorial without my permission.

Cheers!

This post has been edited by supercorey: 09 October 2011 - 08:28 AM


Is This A Good Question/Topic? 11
  • +

Replies To: Installing Android OS 2.2 on a Virtual Machine

#2 xZachtmx  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 125
  • Joined: 14-June 09

Posted 11 October 2011 - 01:29 PM

Very helpful! Thank you very much!
Was This Post Helpful? 0
  • +
  • -

#3 akthechamp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-October 11

Posted 21 October 2011 - 09:16 AM

thanx for the help ;) i was starting to build something for the android platform & this info is very much helpful to me ;)
Was This Post Helpful? 0
  • +
  • -

#4 jackfrost  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 20
  • Joined: 20-June 10

Posted 26 October 2011 - 01:22 PM

Great job supercorey! Thanks for putting in the time, it is greatly appreciated!

This post has been edited by jackfrost: 26 October 2011 - 01:22 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1