Install Android on Hyper-V

One of the labs I’m currently working on is connectivity between SCCM 2012 and Exchange 2010, and how SCCM 2012 can manage non-Windows mobile devices running Apple iOS and Android.  To this end I need some mobile devices for testing, but I don’t have anything running Android.

Fortunately, it’s possible to get a decent Android test platform up and running within a VM on a Hyper-V host system.  Read on to see how it’s done.

To get Android installed within a virtual machine, you need the latest build of the Android-x86 project.  This is an Android build which works on x86-compatible systems.  It has the disadvantage that it’s not authorised to use the official Android application markets like Google’s Android Market or AppBrain, but there is a small app market attached to the project, and the core functionality is all present and correct.

The latest stable build of Android-x86 is 2.2, and I used the android-x86-2.2-generic build, which is available for download here.

The virtual machine settings are pretty basic, as Hyper-V’s support for Linux is by no means comprehensive.  The VM has 512 MB RAM (statically-defined, not Dynamic Memory), a 16GB VHD on the IDE channel and a legacy network adapter:

Android-x86 on Hyper-V - VM Settings

As for the Linux Integration Components…well, it may be possible to get them working, but not without a significant degree of pain, and this VM already has all the functionality it needs for the purpose.

Next, fire up the VM with the android-x86-2.2-generic.iso mounted.  At the start screen, select to install rather than run a Live session:

Android-x86 on Hyper-V - Install

Next, select to create a new partition:

Android-x86 on Hyper-V - Create Partition

In the cfdisk utility, select New to create a new partition which takes up the entire hard drive:

Android-x86 on Hyper-V - New Partition

Once created, mark the partition as bootable and then select Write:

Android-x86 on Hyper-V - Boot Partition

Quit the utility and you’ll get taken back to the partition select screen – there will now be a new partition to house the Android installation:

Android-x86 on Hyper-V - Select Partition

Choose ext3 as the filesystem (other options are available if you want the OS to access filesystems shared with other systems):

Android-x86 on Hyper-V - Select Filesystem

Once the partition is formatted, select Yes to install the GRUB bootloader:

Android-x86 on Hyper-V - GRUB Bootloader

You can also choose to make the /system directory read/write, but this isn’t recommended unless you’re planning on doing some development/debugging work:

Android-x86 on Hyper-V - /system RW

Once the operating system is installed, you can choose to create a fake SD card which is presented to the OS.  This is an .img file which can be up to 2GB in size, and resides on the VHD (within the filesystem):

Android-x86 on Hyper-V - Fake SD Card

Once completed, the system restarts and boots into the Android OS:

Android-x86 on Hyper-V - Main Screen

Without the integration tools, the mouse cursor will be captured whenever you click inside the VM window, and performance isn’t blistering.  However, the cursor replicates the tap and swipe actions of a finger rather well, and the ESC key or right mouse button gets you back from whichever window you find yourself in.

Clicking in the top right-hand corner of the window enables or disables the context menu.  Normally, pulling down the top bar reveals the notification pane, but once the context functionality is enabled, accessing the notification pane instead reveals a context menu down the bottom, and this is used for things like composing new emails within the mail program.

The nice thing with this setup is that it doesn’t need any configuration once it’s installed.  The legacy NIC is automatically connected and the system is online.  If performance and more seamless functionality is important, then I’d recommend installing Android-x86 on VMware Workstation or Sun VirtualBox as they have more generic (and better) support for Linux, but Hyper-V does a good enough job, and in my situation it has the advantage of being connected to the same virtual network as the SCCM and Exchange servers – and given that this is the functionality I’m keen to test, this is more important than bells and whistles 🙂

12 comments to Install Android on Hyper-V

  • Tolga

    Hello James,

    Thank you very much for the wonderful article. I have followed this to the word and installed the system, however I cannot use it because the mouse is not captured. The error message is as follows:

    [quote]
    Mouse not captured in Remote Desktop session.

    The mouse is available in a Remote Desktop session when integration services are installed in the guest operating system. For more information, search on ‘integration services’ in Help.
    [/quote]

    I am connecting to the Android system via Hyper-V Manager -> Connect.

    Any ideas?

    Thank you,
    Tolga

    • James Bannan

      Hi Tolga – are you remoting onto the Hyper-V server via RDP from another workstation? If so, then unfortunately you can’t use the mouse in a Hyper-V Manager console unless the Integration Tools are installed in the guest OS. And given that the guest OS is android-x86, that’s not going to happen.

      • Tolga

        Actually yes, I’m remoting onto the Hyper-V server from my notebook and then using the Hyper-V Manager there. As you just said, I have connected the Hyper-V server from my notebook using the Hyper-V Manager of RSAT and everything is fine now.

        Thank you very much for your reply and for the wonderful article.

  • prasong

    /system directory read/write “Y”

    how can i disable read/write to read only system?
    after system has been installed
    please advise

    Thank you very much
    Prasong P
    ——-

    • James Bannan

      To be honest I have no idea – I don’t tinker with the Android OS. My guess is that the read/write install option sets particular permissions on the /system directory, so if you want to change that you’re either going to have to reinstall the OS or directly modify the permissions.

      This link might help:

  • parob

    Thanks – but on my Windows 2008 R2 Enterprise Server, all I get is an A N D R O I D root@x86:/ # prompt 🙁

  • raha

    Hi
    when I try to create a drive give me the fatal Error and just retry
    have any idea

  • vijay

    Hi
    when I try to install android .iso image in hyper-v. its unable to identify the ide disk. got below error.
    fatal error: cannot open disk drive press any key to exit cfdisk

    any idea …!

  • Stephen Gentile

    Thanks for the write up. Seems to be very close to what I did. I am trying to navigate around the android OS, which works… technically. The cursor only interacts “while” clicking, which means that no matter what, you’re dragging menus around. I have to click and drag the mouse to position it, THEN click again to actually send a “tap” on the screen. Is there any driver/modification that would allow the cursor to move with the mouse movements and only tap when clicking?

  • Walid

    Hello James,

    I’m trying to install android 7.1 “android-x86-7.1-rc2” on Hyper-V that is installed on Azure hosted 2016 server, every thing is going fine and smooth until I choose to install bootloader, everything hangs. Any help will be appreciated.

    Thanks

  • Jay

    I have followed this to the word and installed the system, however I cannot use it because the mouse is not captured. The error message is as follows:

    Mouse not captured in Remote Desktop session.

    The mouse is available in a Remote Desktop session when integration services are installed in the guest operating system. For more information, search on ‘integration services’ in Help.

    when installing integration service support disk getting error disk is locked?

  • Jay

    I have installed Android Oreo on Hyper-V followed this to the word and installed the system, however I cannot use it because the mouse is not captured. The error message is as follows:

    Mouse not captured in Remote Desktop session.

    The mouse is available in a Remote Desktop session when integration services are installed in the guest operating system. For more information, search on ‘integration services’ in Help.

    when installing integration service support disk getting error disk is locked?

Leave a Reply to Stephen Gentile Cancel reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>