Android is a pretty great operating system for phones – it’s versatile, fast and comes with a ton of functions. Of course, if you want to run it on your computer instead of your phone, be it for testing purposes or just for fun, you can do that. All you need to do is to install your chosen version of Android on a normal virtual machine or VM using VirtualBox. Simply follow the steps below and you’ll have Android up and running in no time.
1. Installing Virtual Box and Launching the VM
The first step is, of course, installing VirtualBox. To do so, download the software from the official website and follow the simple install process. Once that’s done, you can get started with the real work: Acquiring an android ISO formatted disk image. The most reliable source for this is the Android-x86 project, a team of open source developers that have spent their time porting android code to work on PC hardware.
Once you’ve got VirtualBox installed and your ISO ready to go, you’ll want to open up Virtual Box and click “New” to create a new VM. You’ll need to configure a name and file location, and it’s also recommended that you set the type to “Other” and the version to “Other/Unknown (64-bit)” (or the 32-bit version if you downloaded a 32-bit ISO). Doing so can avoid some compatibility issues later on.
2. Configuring the VM
The next stage is to configure the amount of memory (RAM) that the VM is allocated. The maximum number is based on the system resources of your computer – you can’t use a 16GB machine to give your VM 32GB of RAM! The absolute minimum that you should allocate is 2GB, but somewhere between 6 and 8GB of RAM is recommended. Remember, this VM needs the same sort of resources a physical mobile handset would have, so more is generally better.
Tip: Make sure to leave a minimum of 4GB of RAM free for the rest of your operating system to use, otherwise, you might run into system instability issues.
The next stage of the VM creation process is to make a new virtual hard drive for your virtual machine. Make sure to select the option to “create a virtual hard disk now” and hit next. Any file type will work, the default of VDI is perfectly functional. Again, hit next, and set the file to be a “Fixed Size”. Finally, configure where on your hard drive you want to save your new virtual drive, and how big a hard drive you need. The minimum hard drive size required for the Android-x86 image is 8GB. Depending on what you are planning to do with the virtual machine a hard drive of 16GB should be more than enough and shouldn’t be too much of a drain on your computer’s resources.
The VM will now show up in your list of machines, but there are a few more things to configure before you’re ready to launch it. Right-click on the device and go into the settings.
In the settings, your first stop is the “Processor” tab under “System”. Here, you can configure the number of CPU cores the VM will have. You should increase this to at least two but preferably more. Just like RAM, this is the same as you wouls see in a physical mobile handset, so more is better.
Tip: The Android-x86 developers warn that only assigning one virtual CPU core to the VM is likely to cause a high chance of system crashes.
The maximum number of CPU cores you can allocate depends on how many cores your computer’s CPU has. Make sure to leave at least two CPU cores to your operating system, although four is better.
Tip: Only physical CPU cores (rather than logical hyperthreaded cores) can be reliably assigned to virtual machines, so don’t go into the red portion of the slider, or you may encounter stability issues.
The next step in the settings is the “Screen” tab under “Display”. Here you want to increase the “Video Memory” available to the VM to 32 or 64MB and ensure that the “Graphics Controller” is set to “VBoxVGA”.
3. Select the ISO
The next step of the setup is to configure the Android ISO disk image to be read as an optical disk by the VM. To do this, click on “Storage”, select the “Empty” CD/DVD image, click the second CD/DVD icon on the right and select “Choose a disk file…”.
Next, you have to select which ISO you want to use. This is where the Android ISO you downloaded earlier comes in to play. It’s likely in your downloads folder (or wherever you saved it to). In Windows File Explorer the file type is listed as “Disc Image File”. Once the ISO is imported hit “OK” to update the VM settings.
4. Launch the VM
Now you are ready to launch the VM for the first time. To start installing Android, just select the VM and then click start.
You may be asked to “Select a start-up disk”, if so, select the Android ISO. The next screen will show boot options, to install Android to the VM you need to scroll down and select the “Installation” option.
Tip: The VM might capture your curser (and keyboard), stopping you from moving your mouse out of the window or tabbing out, to free your mouse to control your computer again, you need to press the “Host” key. The “Host” key is shown in the bottom right-hand corner of the VM window, it may default to “Right Ctrl” if you press the Host key, the VM will release your mouse and keyboard back to the operating system.
The next screen is the “Choose Partition” screen. Here you instruct the VM where to install Android on your virtual hard drive. You won’t have any partitions by default, so press the down arrow to highlight “Create/Modify partitions” and press enter. To create a new partition, highlight the “New” option and press enter. You can now configure the properties of the partition, but you can comfortably leave all the values at their suggested default values.
You should, however, apply a name to the partition. Once the partition is created you need to write the change to the disk. To do this move the cursor to the right and select “Write”, you will be asked to verify you want to make this change, type “yes” and press enter to create the partition. Once this is done select “Quit” to back out to the previous “Choose Partition” screen, here you will notice that your new partition is now available for use.
To install Android to your new partition, you first need to select what file system format you want to use, ext4 is likely your best option, though NTFS and FAT32 will also work. When prompted, verify that you want to format the drive. Next, you will be asked if you want to install the “boot loader GRUB”, select yes, GRUB will be used to boot Android. If prompted to convert the disk from GPT to MBR select “yes” as GRUB and GPT are not compatible. The next prompt will ask if you want the “/system” directory to be “read-write”, select yes.
5. Launch Android
Android is now installing to your virtual hard drive, this process may take time, depending on the system resources you allocated to your VM and your underlying operating system resources. Once installed you’ll be asked if you want to “Launch Android” or to reboot (the VM), select “Launch Android” and your Android VM will come to life.
From here you should configure your Android VM as you would any other Android device. The settings you pick are entirely up to you. When the setup is complete, you can use your Android setup however you would like.
6. Shutting it down
The final thing to do, once you’ve shut off your Android VM for the first time is to remove the ISO, if you don’t do this you will be asked to install Android every time the VM boots up. To remove the ISO, open the VM’s settings, go to the “Storage” tab, click on the two CD/DVD’s from before and click “Remove Disk from Virtual Drive” and save the changes.