问题
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?
回答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.
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
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!!
来源:https://stackoverflow.com/questions/59527115/haxm-does-not-support-nested-virtual-machines-gcp