简体   繁体   English

Android Studio 未在 AMD Ryzen 上启动 Android 仿真器

[英]Android Studio not launching Android emulator on AMD Ryzen

[AMD Ryzen 3600 CPU, Win10 Professional, MSI B450 Gaming Plus] [AMD Ryzen 3600 CPU、Win10 Professional、MSI B450 Gaming Plus]

So, hello people.所以,大家好。 This problem is seemingly a known one but it came with a twist here.这个问题似乎是一个已知的问题,但这里有一个转折点。 I'll try to keep it as simple as possible:我会尽量保持简单:

  1. I installed Docker for a hobby project of mine.我为我的一个爱好项目安装了 Docker。 Docker needs Hyper-V to be turned on in the Windows features so I did that. Docker 需要在 Windows 功能中打开 Hyper-V,所以我这样做了。 It said I need to turn on virtualization in Bios, did that too.它说我需要在 Bios 中打开虚拟化,也这样做了。
  2. Later on, I installed Android studio which greeted me with an error message about "HAXM" not being able to install itself.后来,我安装了 Android 工作室,它向我打招呼,提示“HAXM”无法自行安装。 I ignored that since I had no idea what that is.我忽略了这一点,因为我不知道那是什么。
  3. I started a plain new Android native (Java) project in Android studio, set up an emulator which said I have to turn off Hyper-V in order for it to work.我在 Android 工作室中启动了一个全新的 Android 本机(Java)项目,设置了一个模拟器,上面说我必须关闭 Hyper-V 才能使其工作。 I did that.我这样做了。 Didn't use Docker since, even removed docker cause the app is currently my priority.从那以后没有使用 Docker ,甚至删除了 docker 因为该应用程序目前是我的优先事项。
  4. The native app worked.本机应用程序有效。 Then I tried to make a Flutter app in Android studio.然后我尝试在 Android 工作室中制作 Flutter 应用程序。 Installed the Dart and Flutter plugins but the virtual device I set up for the other project wasn't visible.安装了 Dart 和 Flutter 插件,但我为其他项目设置的虚拟设备不可见。 Flutter doctor said I should set the SDK path for Flutter (meaning setting the Path and another environment variable). Flutter 医生说我应该为 Flutter 设置 SDK 路径(意思是设置路径和另一个环境变量)。 Did that.做过某事。 Emulator worked.模拟器工作。
  5. Yesterday I started my PC and tried running the Flutter app.昨天我启动了我的电脑并尝试运行 Flutter 应用程序。 When I launch the emulator in Android Studio it says:当我在 Android Studio 中启动模拟器时,它说:

emulator: ERROR: x86 emulation currently requires hardware acceleration.模拟器:错误:x86 仿真当前需要硬件加速。 Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable: CPU acceleration status: GVM is not installed on this machine More info on configuring VM acceleration on Windows: https://developer.android.com/studio/run/emulator-acceleration#vm-windows If you are using an Intel CPU: please check that virtualization is enabled in the BIOS and that HAXM is installed and usable.请确保 Windows Hypervisor Platform (WHPX) 已正确安装且可用: CPU 加速状态:此机器上未安装 GVM 有关在 Windows 上配置 VM 加速的更多信息: https://developer.ZC31B32364CE19CA8FCD150A417/runECulator58FCD150A417加速#vm-windows如果您使用的是 Intel CPU:请检查 BIOS 中是否启用了虚拟化,并且 HAXM 已安装且可用。 Note: if Hyper-V or Credential Guard is enabled, the emulator will not work with HAXM.注意:如果启用了 Hyper-V 或 Credential Guard,模拟器将无法与 HAXM 一起使用。 Seehttps://github.com/intel/haxm/issues/105#issuecomment-470927735 for info on how to disable Credential Guard.有关如何禁用 Credential Guard 的信息,请参阅https://github.com/intel/haxm/issues/105#issuecomment-470927735 If you are using an AMD CPU or need to run alongside Hyper-V-based apps such as Docker, we recommend using Windows Hypervisor Platform.General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration . If you are using an AMD CPU or need to run alongside Hyper-V-based apps such as Docker, we recommend using Windows Hypervisor Platform.General information on acceleration: https://developer.android.com/studio/run/emulator-加速

  1. The text says I should have "Windows Hypervisor Platform" turned on.文字说我应该打开“Windows Hypervisor Platform”。 I didn't have that turned on in the Windows features and it worked nonetheless, Well.我没有在 Windows 功能中打开它,但它仍然有效,嗯。 I still turned that on cause it seems that's recommended for AMD CPUs.我仍然打开它,因为它似乎推荐用于 AMD CPU。 Now Hyper-V is turned off , the Hypervisor Platform is turned on , virtualization in BIOS is turned on , ( Windows Defender memory management is turned off , too, since many suggestions pointed out that's important?).现在Hyper-V 已关闭Hypervisor Platform 已打开BIOS 中的虚拟化已打开,( Windows Defender memory 管理也已关闭,因为许多建议指出这很重要?)。
  2. Emulator still doesnt work and if I try to install HAXM through Android Studio->Settings->System Settings->Android SDK->SDK Tools it says:模拟器仍然无法工作,如果我尝试通过 Android Studio->Settings->System Settings->Android SDK->SDK Tools 安装 HAXM,它会说:

HAXM installation failed. HAXM 安装失败。 To install HAXM follow the instructions found at: https://software.intel.com/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows Installer log is located at C:\Users\JaySON\AppData\Local\Temp\haxm_log7.txt Installer log contents:要安装 HAXM,请按照以下位置的说明进行操作: https://software.intel.com/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows安装程序日志位于 C:\Users JaySON\AppData\Local\Temp\haxm_log7.txt 安装程序日志内容:

This computer does not support Intel Virtualization Technology (VT-x) or it is being exclusively used by Hyper-V.此计算机不支持 Intel 虚拟化技术 (VT-x),或者它被 Hyper-V 独占使用。 HAXM cannot be installed.无法安装 HAXM。 Please ensure Hyper-V is disabled in Windows Features, or refer to the Intel HAXM documentation for more information.请确保在 Windows 功能中禁用 Hyper-V,或参阅英特尔 HAXM 文档了解更多信息。

Now I have no idea what to do.现在我不知道该怎么办。 Some people sugggest I should turn ON Hyper-V, some suggest I should turn on Hyper-V AND the platform, some suggest I should turn both OFF, some suggest I should turn both off AND that's only possible through various CLI commands etc. Help.有些人建议我应该打开 Hyper-V,有些人建议我应该打开 Hyper-V 和平台,有些人建议我应该同时关闭,有些人建议我应该同时关闭,这只能通过各种 CLI 命令等来实现。帮助. ;-; ;-;

Ok, so I just went in with the almost typical approach of "let's just push buttons until it works".好的,所以我只是采用了几乎典型的方法“让我们按下按钮直到它起作用”。 I disabled the Windows Hypervisor Platform (Hyper-V was still disabled), it didn't work.我禁用了 Windows 管理程序平台(Hyper-V 仍然被禁用),它没有工作。 I enabled both, didn't work.我都启用了,没有用。 I disabled both and then enabled Hyper-V without the Platform.我禁用了两者,然后在没有平台的情况下启用了 Hyper-V。 THIS WORKED.这行得通。 However, to anyone reading this: It's now what it's supposed to be doing, So if you have the same problem.但是,对于任何阅读本文的人:现在它应该做的是,所以如果你有同样的问题。 just try all possible combinations of those two.只需尝试这两者的所有可能组合。 Afaik there's no correct way of doing that. Afaik 没有正确的方法可以做到这一点。 Even people with a Ryzen CPU like myself got different results, For some it worked to just disable both, for some it only works if both are present.即使像我这样拥有 Ryzen CPU 的人也得到了不同的结果,对于某些人来说,它只是禁用两者,对于某些人来说,它只有在两者都存在时才有效。 some only work with HAXM installed even though that's for Intel CPUs and for me it worked just by re-enabling Hyper-V for the third time.有些仅适用于安装了 HAXM,即使这是针对英特尔 CPU 的,对我而言,它仅通过第三次重新启用 Hyper-V 即可工作。

"Have you tried turning it off and on again" with extra steps “您是否尝试过将其关闭然后再打开”以及额外的步骤

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM