Virtualise Android Lollipop on your Windows PC

Thanks to the lucky dip that is Android updates, the Android Community has become extremely adept at porting the latest versions of Google’s mobile OS onto an ever-growing number of devices supposedly long past their used-by date.

My Samsung Galaxy S3 powered by the latest Lollipop/5.1.1 is proof enough.

But a useful side-option is running Lollipop on your Windows PC — not as a dual-boot, but as an actual Windows app. Combine the goodness of Android-x86 and Oracle’s VirtualBox virtualisation tool and that’s exactly what you can do.

It won’t play Angry Birds or Clash of Clans, but you’ll be able to run a heap of Android apps inside a Lollipop virtual device right on your Windows desktop. Here’s how.

Get the software

Make sure you download the required software — it’s free:

Android-x86 5.1.1 Lollipop 32-bit ISO image
Oracle VirtualBox 5.0

What you’ll need

In terms of hardware, you’ll need a Windows 7 or later PC with at least 4GB of RAM and 20GB of free hard drive space (you’ll use 1GB of RAM and 8GB of that drive space with default settings).

Start by grabbing the software, installing VirtualBox and launching it.

Creating the virtual machine

begin-1This is fairly straightforward, but here’s a quick walkthrough.

You begin by selecting New from the menu and on the Create Virtual Machine window, give your VM a name (no spaces), set the Type to ‘Linux’ and Version to ‘Other Linux 32-bit’. Press Next.

Now set the Memory Size slider on the following screen to 1GB (1,024MB) and tap the Next button.

begin-2VirtualBox will default the virtual hard disk size to 8GB, which is fine to start with, so just press the Create button.

Next, use the default VDI (VirtualBox Disk Image) format and press Next, also use the default ‘Dynamically allocated’ storage option and press Next again.

You can choose the file location and set the drive size on the next window if you wish, but just press Create and it will store the VM files in the standard user//virtualbox subfolder.

Once you’ve stepped through that lot, you’ll be back at the VirtualBox screen with your virtual machine (VM) created.

Loading in the ISO image

begin-3Now it’s time to load the OS — to set it so the OS boot menu fires when we launch the VM, look for the Storage groupbox on the VirtualBox Manager screen, right-click on the IDE Secondary Master (which should be labeled ‘[Optical Drive] Empty’) and choose the location of your Lollipop ISO image.

As soon as you select it, the ‘Empty’ should be replaced by the ISO filename. Now just select your Android VM from the left list and press the green Start arrow button.

begin-4You’ll be asked to select a start-up disk, so choose the Android ISO file from the drop-down list and click the Start button.

This should launch the VM and boot the live ISO image — within a second or two, the blue Android boot menu should appear.

Left-click inside the VirtualBox Android screen to transfer mouse control from your Windows PC to the VM — to get it back, the default control should be the right Control keyboard key.

Press it once and your mouse should move back into Windows-world.

Feel free to run the LiveCD option to try things out; however, you won’t be able to save anything (there’s no persistence), so use the keyboard arrow keys and select the Installation option.

inst-1What you’ll see next is the Android-x86 drive partition/formatting utility with an entry something like ‘sda unknown VBOX HARDDISK’ highlighted.

You don’t want that one — down-arrow to Create/Modify partitions and choose this one instead.

Next, you’ll be asked if you want to use a GPT partition table. Choose No and press Enter. This will bring up the cfdisk formatting utility.

Formatting the drive

inst-2Cfdisk’s command menu operates by left- and right-arrow keys, while to select the drive partitions, you use the up- and down-arrow keys.

First things first, pressing the Enter key confirms all commands, so start by selecting New to create a new partition and press Enter.

Choose Primary, use the full displayed partition size (8587.19MB).

Next, select Bootable to make the disk bootable and finally, choose the Write command to make it all happen (cfdisk will still require you to confirm this step by typing ‘yes’).

You’ll get “warning — your disk will be erased” signs at this point, but what you’re doing is created a ‘soft’ hard drive, which is really just a file on your Windows computer.

inst-3This is why I love virtual machines much more than dual-booting — not only can you run two OSs at the same time, it’s also inherently easier to deal with because you’re creating a computer as a software app and file, not modifying a physical partition.

Anyway, now choose Quit and you’ll go back to the Select Partition window we had before. This time, choose the ‘sda1’ option and hit the OK button.

Next, you need to select the ‘ext4’ filesystem option (again, press the OK button), choose ‘Yes’ to formatting the partition and press Enter.

After that, you have to install the GRUB boot loader, so on this screen, choose ‘Yes’ and again press Enter. Skip installing EFI GRUB2 — we don’t want it.

inst-4Finally, choose ‘No’ to having the system folder as read-write and the ISO image should begin writing to the 8GB ‘partition’.

You know you’re done when you see the ‘Run Android’, ‘Reboot’ menu. But at this point though, do neither — press the right Control key to get back to Windows and on the VirtualBox Android VM Window menu, select File, Close and ensure the ‘Power off the machine’ option is selected.

First boot

vm-1There’s one last thing we need to do before we first-boot our new VM and that’s to right-click on the IDE Secondary Master option again in Storage and select ‘Remove disk from virtual drive’.

We no longer need the ISO image and it’ll just boot-loop if we leave it there.

With that done, select the Android VM again from the left list in VirtualBox Manager, hit the green Start button and launch the VM again.

This time, you’ll get the Android 5.1.1 menu and, after a five-second countdown, the OS should auto-launch and show you the big white Android logo. It’ll take about a minute or so to sort itself out, but eventually, you’ll get the Welcome screen.

The rest should be fairly familiar, but just a couple of tips. First, in VirtualBox’s VM window menu, choose Input, Mouse Integration to switch from Windows to Android mouse cursor.

Click inside the VirtualBox window, move the mouse (you must move it) and the cursor will appear.

Second, forget SIM cards and Wi-Fi networks — VirtualBox automagically reroutes Android’s network needs through your Windows PC.

Built-in goodies

From there, just follow the Android setup routine as you normally would. What’s cool about Lollipop Android-x86 RC1 is that it comes with working Google Play and Gmail, so you have a squillion apps and your email ready to go.

It’s also root-ready — whether you consider that a good thing or not is up to you. But best of all, you now have persistence, so apps installed will stay installed when you shut down and reboot the virtual machine.

What apps work and don’t work?

Given this is a first ‘release candidate’ (it only hit the web at the beginning of October 2015), it’s surprisingly stable and well-stocked.

As soon as you hit the launcher screen, you should see your email and backed-up apps begin downloading in the background (something to be aware of if you’re on mobile broadband).

But what you won’t get working are big-name games like Angry Birds or Clash of Clans. Unfortunately, VirtualBox doesn’t virtualise Android graphics beyond the basics. Low-octane games should work, but anything involving OpenGL probably not.

Getting a bigger screen

vm-2You’ll no doubt notice VirtualBox only gives you a default 800 x 600-pixel window for your virtualised Android but there is a temporary work-around.

Reset your Android VM to restart it and load the Android menu. Before the five seconds are up and it runs the default option, press a down arrow key to toggle off the auto-load option, make sure you go back to the first ‘5.1-RC1’ option, then press the E key — this switches into command-edit mode.

You should now see two command lines, one starting ‘kernel’, the other ‘initrd’ (initial ram drive). Make sure the ‘kernel’ command is highlighted and press E again. This gives you a very basic BASH command editor and dumps you at the end of that command line. Now type a space and vga=791 (must be lowercase), press Enter and the B key to reboot.

GRUB is the Linux bootloader that launches the Android OS and allows you to choose video modes by number. The code ‘791’ denotes 1024×768-pixels and 16-bit colour, ‘794’ is 1280×1024-pixels/16-bit. Unfortunately, as we said, this is only temporary — reboot the VM and it’ll go back to default 800×600-pixels.

Editing menu.lst

screen-2The permanent solution requires some Linux command line jujitsu. Here’s what you do:

STEP 1. Reboot the Android VM, but in the boot menu, select the first ‘debug mode’ option.

Let it spin through the command-line info for a few seconds until it stops. Press the Enter key and you should see the Linux command prompt.

STEP 2. We need to edit that boot menu and, to do that, we have to load up or ‘mount’ the grub subfolder as a rewriteable folder, so on the command prompt, type:

mount –o remount,rw /mnt
cd /mnt/grub
vi menu.lst

Press the Enter key at the end of each line. Vi is a teeny-tiny text editor built into almost every Linux distro and, after that last line, you should see the menu text appear in the editor.

Press the I key to go into Vi’s insert mode. Next, move the cursor to the end of the first kernel line and add the text vga=791 (remember, this is 1,024 x 768- pixels at 16-bit colour, change it to vga=794 for 1,280 x 1,024-pixels).

Press the Escape key to go back to control mode (character at the bottom left of the panel will go from ‘I’ to ‘-‘) and hit Shift-ZZ to save the changes. This should drop you back to the Linux command prompt at the same time.

STEP 3. Now we clean up our doodling with the following commands:

cd /
su umount /mnt
reboot –f

On hitting the Enter key the last time, the VM should reboot and, as soon as you select the first ‘Android’ menu entry, the VM should launch into your desired resolution as a permanent feature.

Changing back again

If you decide to change the screen resolution later, just follow the same procedure again and either change the VGA number or simply remove the ‘vga=xxx’ text altogether. Again, remember it is ‘vga’, not ‘VGA’. Use capital letters and it won’t work.

If you set the VM to 1,280 x 1,024-pixels, you need at least a 1,920 x 1,200-pixel monitor to view it correctly due to the VirtualBox app frame. If you only have a 1080p monitor, choose the ‘vga=791’ option and a 1,024 x 768-pixel frame size instead.

Getting sound

One last thing — VirtualBox will use your PC’s integrated audio, but if you use a USB audio device, you’ll need to tell the app to use it.

Power off your Android VM and make sure your USB audio device is plugged into the PC, ready to go. Next, go to the VirtualBox Manager, click on the Android VM, select Settings from the menu. Choose USB from the left menu on the new Settings screen and click on the icon second from the top on the far right side with the ‘+’ sign.

This will add any USB devices, including audio, to the setup and allow the Android VM to use them. The only problem is that the Android VM has no volume controls and VirtualBox doesn’t route Android audio through Windows Audio controls, so it pretty much just gives you full-bore audio levels.

Zero-cost Android

But the ultimate value here is that you can have your own Android Lollipop setup running as an app on your Windows PC and it’s completely free.

So even if your favourite phone or tablet can’t run Lollipop, you can build your own PC setup using virtualisation.