1

I am trying to use an Android virtual device (AVD) on my android development environment which is a GCP Compute Engine Windows server Virtual Machine.

When I try to create a virtual android device I get a recommendation that states:

HAXM does not support nested virtual machines

How can I create an Android virtual device in side of my GCP Windows Server VM?

Google Tracker issue

Rishit Dagli
  • 1,000
  • 8
  • 20
  • Check this: https://stackoverflow.com/questions/31243532/android-studio-running-on-vmware-virtual-machine-kvm-is-not-installed – Md. Asaduzzaman Dec 30 '19 at 07:27
  • @Md.Asaduzzaman this is not the problem I face, I am not using KVM, I am on a windows VM and the solutions won't work for me either I am on a GCP instance – Rishit Dagli Dec 30 '19 at 15:37

1 Answers1

1

This was indeed a hard problem to solve. Preet Parekh and I finally came up with a solution for this. The results were extremely wonderful. With the power of Cloud, we could do the first Gradle Builds in just 1 second!!

Jist of the solution

So, GCP or for that matter any other cloud supporter will not provide you the ability to create nested virtual machines. It is blocked by default so the Android studio would work but you would not be able to run an AVD, that’s not much useful.

So, we use a different architecture for the VMs to support nested virtualization.

Nested virtualization

In GCP Nested virtualization can only be enabled for L1 VMs running on Haswell processors or later. If the default processor for a zone is Sandy Bridge or Ivy Bridge, you can use minimum CPU selection to choose Haswell or later for a particular instance.

Which means you can only allow nested virtualization on the following OSes

OSes which allow nested VM

To allow this you would then add the following license while VM creation-

https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx

This was just a short just of what you would do and the major steps involved, however, I highly recommend you to read this blog by Preet and me which provides a step by step guide to doing so. Get ready to do Gradle builds in 1 second!!

Rishit Dagli
  • 1,000
  • 8
  • 20