我可以在微软hyper-v虚拟机中运行Android SDK模拟器吗?

时间:2020-12-20 18:55:48

Can I run Android Studio and Android SDK emulator in a Microsoft hyper-v virtual machine? Please read carefully.

我可以在微软hyper-v虚拟机中运行Android Studio和Android SDK仿真器吗?请仔细阅读。

I already use Hyper-V a lot for other purposes. Now I need to develop a app for Android.

我已经为其他目的使用Hyper-V了。现在我需要开发一个Android应用程序。

I've installed a new virtual machine (windows 10) and installed Android Studio. I cannot run the android emulator because it's lacking the 'intel HAXM software'.

我安装了一个新的虚拟机(windows 10)并安装了Android Studio。我无法运行android模拟器,因为它缺少“intel HAXM软件”。

I read a lot about that it's not possible to install Hyper-V NEXT to Android Studio, but non of the post actually say anything about installing in a Hyper-V machine.

我读过很多关于在Android Studio下安装Hyper-V的事情,但是没有人会说任何关于安装在Hyper-V机器上的事情。

3 个解决方案

#1


33  

Refer to this link: How to run Android Studio on Windows without disabling Hyper-V

请参考这一链接:如何在Windows上运行Android Studio而不禁用Hyper-V。

The solution (if you do not want to disable Hyper-V) is to use Microsoft’s Android emulator, which is a free download here.

解决方案(如果你不想禁用Hyper-V)就是使用微软的Android模拟器,这是免费下载。

In order to use this with Android Studio, you need to run the emulator first. Then, in Android Studio, go to Run – Edit Configurations and select Show Device Chooser Dialog under Deployment Target Options.

为了使用Android Studio,首先需要运行模拟器。然后,在Android Studio中,运行-编辑配置,并在部署目标选项下选择Show Device Chooser对话框。

Run your project, and select the VS Emulator, ignoring the invitation to “Turn off Hyper-V”.

运行您的项目,并选择VS仿真器,忽略“关闭Hyper-V”的邀请。

#2


5  

Hyper-V added support for nested virtualization in the Windows 10 Anniversary Update (released August 2016) and Windows Server 2016. However, the only Microsoft-supported usage of nested virtualization is running Hyper-V within the VM, not HAXM. From the official documentation, "Virtualization applications other than Hyper-V are not supported in Hyper-V virtual machines, and are likely to fail."

Hyper-V在Windows 10周年更新(2016年8月发布)和Windows Server 2016中增加了对嵌套虚拟化的支持。然而,在虚拟机中,惟一支持使用的是microsoft支持的嵌入式虚拟化,而不是HAXM。从官方文档中可以看到,“Hyper-V之外的虚拟化应用程序不支持Hyper-V虚拟机,而且很可能会失败。”

That said, the change log for the latest release of HAXM reports that Intel "Fixed an issue with Hyper-V nested virtualization support, which had prevented Android Emulator from booting." So while it isn't supported by Microsoft, it seems running HAXM nested in a Hyper-V VM may be possible.

也就是说,最新发布的HAXM报告的更改日志报告说,Intel“解决了Hyper-V嵌套虚拟化支持的问题,这阻止了Android模拟器的启动。”因此,虽然它不受微软的支持,但似乎在hyxm中嵌套在Hyper-V虚拟机中是可能的。

If that's the case, to get HAXM working in a Hyper-V VM, you will need to enable nesting for that VM. Run this command on the VM while it is in the OFF state:

如果是这样,为了让HAXM在Hyper-V VM中工作,您将需要为该VM启用嵌套。当它处于OFF状态时,在VM上运行这个命令:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true

After that, you should be able to install the latest version of HAXM within the VM, allowing use of the Android Emulator. Again, I haven't personally verified this, and it isn't supported by Microsoft, so your mileage may vary.

在此之后,您应该能够在VM中安装最新版本的HAXM,从而允许使用Android模拟器。再说一次,我没有亲自验证过,也没有微软的支持,所以你的里程可能会有所不同。

Full disclosure: I work at Microsoft on the Hyper-V team.

全面披露:我在微软的Hyper-V团队工作。

#3


0  

Just make sure before you start with the steps suggested by lotosbin you complete the following:

在你从lotosbin建议的步骤开始之前,确保你完成以下步骤:

Open an admin command prompt and enter the following; then restart the emulator.

打开管理命令提示符并输入以下内容;然后重新启动模拟器。

`reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools" /v Path /d %localappdata%\Android\sdk`

Or update the registry manually:

或手动更新注册表:

  1. In regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node.
  2. 在regedit中,导航到HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node。
  3. Create a new key named Android SDK Tools(if not there already).
  4. 创建一个名为Android SDK工具的新密钥(如果还没有的话)。
  5. Navigate to that key.
  6. 导航键。
  7. Create a new string value named Path. Set its value to the location of your Android SDK, which will be like C:\Users\YourName\AppData\Local\Android\sdk.
  8. 创建一个名为Path的新字符串值。将其值设置为Android SDK的位置,将像C:\Users\YourName\AppData\Local\Android\sdk.

#1


33  

Refer to this link: How to run Android Studio on Windows without disabling Hyper-V

请参考这一链接:如何在Windows上运行Android Studio而不禁用Hyper-V。

The solution (if you do not want to disable Hyper-V) is to use Microsoft’s Android emulator, which is a free download here.

解决方案(如果你不想禁用Hyper-V)就是使用微软的Android模拟器,这是免费下载。

In order to use this with Android Studio, you need to run the emulator first. Then, in Android Studio, go to Run – Edit Configurations and select Show Device Chooser Dialog under Deployment Target Options.

为了使用Android Studio,首先需要运行模拟器。然后,在Android Studio中,运行-编辑配置,并在部署目标选项下选择Show Device Chooser对话框。

Run your project, and select the VS Emulator, ignoring the invitation to “Turn off Hyper-V”.

运行您的项目,并选择VS仿真器,忽略“关闭Hyper-V”的邀请。

#2


5  

Hyper-V added support for nested virtualization in the Windows 10 Anniversary Update (released August 2016) and Windows Server 2016. However, the only Microsoft-supported usage of nested virtualization is running Hyper-V within the VM, not HAXM. From the official documentation, "Virtualization applications other than Hyper-V are not supported in Hyper-V virtual machines, and are likely to fail."

Hyper-V在Windows 10周年更新(2016年8月发布)和Windows Server 2016中增加了对嵌套虚拟化的支持。然而,在虚拟机中,惟一支持使用的是microsoft支持的嵌入式虚拟化,而不是HAXM。从官方文档中可以看到,“Hyper-V之外的虚拟化应用程序不支持Hyper-V虚拟机,而且很可能会失败。”

That said, the change log for the latest release of HAXM reports that Intel "Fixed an issue with Hyper-V nested virtualization support, which had prevented Android Emulator from booting." So while it isn't supported by Microsoft, it seems running HAXM nested in a Hyper-V VM may be possible.

也就是说,最新发布的HAXM报告的更改日志报告说,Intel“解决了Hyper-V嵌套虚拟化支持的问题,这阻止了Android模拟器的启动。”因此,虽然它不受微软的支持,但似乎在hyxm中嵌套在Hyper-V虚拟机中是可能的。

If that's the case, to get HAXM working in a Hyper-V VM, you will need to enable nesting for that VM. Run this command on the VM while it is in the OFF state:

如果是这样,为了让HAXM在Hyper-V VM中工作,您将需要为该VM启用嵌套。当它处于OFF状态时,在VM上运行这个命令:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true

After that, you should be able to install the latest version of HAXM within the VM, allowing use of the Android Emulator. Again, I haven't personally verified this, and it isn't supported by Microsoft, so your mileage may vary.

在此之后,您应该能够在VM中安装最新版本的HAXM,从而允许使用Android模拟器。再说一次,我没有亲自验证过,也没有微软的支持,所以你的里程可能会有所不同。

Full disclosure: I work at Microsoft on the Hyper-V team.

全面披露:我在微软的Hyper-V团队工作。

#3


0  

Just make sure before you start with the steps suggested by lotosbin you complete the following:

在你从lotosbin建议的步骤开始之前,确保你完成以下步骤:

Open an admin command prompt and enter the following; then restart the emulator.

打开管理命令提示符并输入以下内容;然后重新启动模拟器。

`reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools" /v Path /d %localappdata%\Android\sdk`

Or update the registry manually:

或手动更新注册表:

  1. In regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node.
  2. 在regedit中,导航到HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node。
  3. Create a new key named Android SDK Tools(if not there already).
  4. 创建一个名为Android SDK工具的新密钥(如果还没有的话)。
  5. Navigate to that key.
  6. 导航键。
  7. Create a new string value named Path. Set its value to the location of your Android SDK, which will be like C:\Users\YourName\AppData\Local\Android\sdk.
  8. 创建一个名为Path的新字符串值。将其值设置为Android SDK的位置,将像C:\Users\YourName\AppData\Local\Android\sdk.