Android 如何解决:“HAX 不工作,模拟器在模拟模式下运行”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21031903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:52:46  来源:igfitidea点击:

How to fix: "HAX is not working and emulator runs in emulation mode"

androidmacosandroid-emulator

提问by GnrlBzik

Question is

问题是

I get "HAX is not working and emulator runs in emulation mode", is this related to Intel x86 Emulator Accelerator (HAXM) installation and running avd with cpu set to CPU Intel Atom (x86)? And even though it feels like AVD runs faster after i installed HAXM, does this message indicates that AVD performance is hindered. Should it be fixed and if so, how?

我得到“HAX 不工作,模拟器在模拟模式下运行”,这与英特尔 x86 模拟器加速器 (HAXM) 安装和运行 avd 相关,cpu 设置为 CPU Intel Atom (x86)?即使在我安装 HAXM 后感觉 AVD 运行得更快,此消息是否表明 AVD 性能受到阻碍。是否应该修复,如果是,如何修复?

I am running on mac os x 10.9.1.

我在 mac os x 10.9.1 上运行。

Listing what is installed on my system via android sdk manager:

通过 android sdk 管理器列出我的系统上安装的内容:

  • Tools
    • Android SDK Tools Rev 22.3
    • Android SDK Platform-tools rev 19.0.1
    • Android SDK Build-tools Rev 19.0.1
    • Android SDK Build-tools Rev 19
  • 工具
    • Android SDK 工具修订版 22.3
    • Android SDK 平台工具修订版 19.0.1
    • Android SDK 构建工具 Rev 19.0.1
    • Android SDK 构建工具 Rev 19

==

==

  • Android 4.4.2 (API 19)
    • SDK Platform
    • ARM EABI v7a System Image
    • Intel x86 Ato System Image
    • Google APIs
    • Sources for Android SDK
  • 安卓 4.4.2 (API 19)
    • SDK平台
    • ARM EABI v7a 系统映像
    • Intel x86 Ato 系统映像
    • 谷歌 API
    • Android SDK 的来源

==

==

  • Extras
    • Intel x86 Emulator Accelerator (HAXM) AND I ALSO run dmg installer as well, and installed hot fix, after i found out about it.
  • 附加功能
    • 英特尔 x86 仿真器加速器 (HAXM) 和我也运行了 dmg 安装程序,并在我发现它后安装了修补程序。

AVD set up

AVD 设置

  • Platform 4.4.2
  • API Level 19
  • CPU Intel Atom (x86)
  • 平台 4.4.2
  • API 级别 19
  • CPU 英特尔凌动 (x86)

Once i run avd:

一旦我运行avd:

(ruby-2.0.0-p353) .android   $ tools/emulator -avd 1AVD -wipe-data -no-boot-anim -cpu-delay 0

i get following and emulator eventually loads

我得到关注和模拟器最终加载

emulator: The memory needed by this VM exceeds the driver limit.

HAX is not working and emulator runs in emulation mode

回答by ph0b

Yes it should be fixed, HAXM isn't working. How much RAM is set for use inside your AVD configuration ?

是的,应该修复,HAXM 不起作用。在您的 AVD 配置中设置了多少 RAM 供使用?

768M is a good number for it, but most importantly this number has to be lower or equal to the memory usage you have set during the installation of HAXM. You can launch its installation again to modify it.

768M 是一个不错的数字,但最重要的是,这个数字必须小于或等于您在安装 HAXM 期间设置的内存使用量。您可以再次启动其安装以对其进行修改。

回答by ccpizza

If you are on a mac you can install haxmusing homebrewvia caskwhich is a built-in extension (as of 2015) which allows installing non-open-source and desktop apps (i.e. chrome, firefox, eclipse, etc.):

如果您使用的是 mac,您可以通过caskhaxm使用自制软件进行安装,这是一个内置扩展(截至 2015 年),它允许安装非开源和桌面应用程序(即 chrome、firefox、eclipse 等):

brew cask install intel-haxm 

Android Studio

安卓工作室

If you are using Android Studio then you can achieve the same result from the menu Tools? SDK Manager, and then on the SDK Toolstab, select the checkbox for Intel x86 Emulator Accelerator (HAXM installer), and click Ok.

如果您使用的是 Android Studio,那么您可以从菜单中获得相同的结果Tools吗?SDK Manager,然后在SDK Tools选项卡上,选中Intel x86 Emulator Accelerator (HAXM installer)的复选框,然后单击Ok

回答by geckob

The way I solved it is by setting the AVD memory limit and HAXM memory to be equal in size which is 1 GB = 1024 MB. The AVD cannot have higher memory limit than the HAXM.

我解决它的方法是将 AVD 内存限制和 HAXM 内存设置为大小相等,即 1 GB = 1024 MB。AVD 的内存限制不能高于 HAXM。

1. Setting the HAXM memory to be 1024 M

1.设置HAXM内存为1024M

The only way to change the HAXM memory is by installing it again. I did it using the terminal. Locate Hardware_Accelerated_Execution_Managerin your machine. Then change directory that folder to run the installation script.

更改 HAXM 内存的唯一方法是重新安装它。我是用终端做的。在您的机器中找到Hardware_Accelerated_Execution_Manager。然后更改该文件夹的目录以运行安装脚本。

cd ~/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager

-OR-

cd ~/Library/Developer/Xamarin/android-sdk-macosx/extras/intel/Hardware_Accelerated_Execution_Manager

May need to change permissions:

可能需要更改权限:

sudo chmod 755 "HAXM installation"

Then:

然后:

./HAXM\ installation -m 1024

-OR-

sudo ./"HAXM installation" -m 1024

2. Setting the virtual device the same size with HAXM memory limit

2. 将虚拟设备设置为与HAXM内存限制相同的大小

enter image description here

在此处输入图片说明

This works for me. Good luck!

这对我有用。祝你好运!

回答by hypery2k

install the latest HAXM from intel: https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager

从英特尔安装最新的 HAXM:https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager

After this it's working

在此之后它的工作

回答by Neurotransmitter

For Windows.

对于 Windows。

In Android Studio:

Android Studio

Tools> Android> AVD Manager> Your Device> Pencil Icon> Show Advanced Settings> Memory and Storage> RAM> Set RAM to your preferred size.

工具> Android> AVD 管理器>您的设备>铅笔图标>显示高级设置>内存和存储> RAM> 将 RAM 设置为您喜欢的大小。

In Control Panel:

Control Panel

Programs and Features> Intel Hardware Accelerated Execution Manager> Change> Set manually> Set RAM to your preferred size.

程序和功能> Intel 硬件加速执行管理器>更改>手动设置 > 将 RAM 设置为您的首选大小。

It is better for RAM sizes set in both places to be the same.

最好在两个地方设置的 RAM 大小相同。

回答by Mohamed

Check the latest version of Has on Intel website and install it. Let the ram in recommended size "preset 2048", then try to run the app. Things should work fine.

在英特尔网站上查看最新版本的 Has 并安装它。让内存在推荐大小“预设 2048”,然后尝试运行应用程序。一切正常。

回答by HAL-9000

Yes it should be fixed, HAXM isn't working.

是的,应该修复,HAXM 不起作用。

HAXM sometimes works; experience with HAXM is currently sporadic across platforms.

HAXM 有时有效;目前跨平台使用 HAXM 的经验是零星的。

For instance, I've got late 2009 iMac running 10.8.5 and i7 processor @2.8Ghz, Android SDK 22.6 with all the goodies updated this morning (03/05/14). API17 will build emulators with HAXM acceleration on this iMac machine, API19 chokes out.

例如,我有 2009 年末的 iMac,运行 10.8.5 和 i7 处理器 @2.8Ghz,Android SDK 22.6,今天早上(03/05/14)更新了所有好东西。API17 将在这台 iMac 机器上构建具有 HAXM 加速的模拟器,API19 窒息。

I also have early 2013 MBP 15" Retina running 10.8.5 and i7 processor @2.7Ghz, Android SDK 22.6 with all the goodies updated this morning (03/05/14). API17 will build emulators with HAXM acceleration, API19 works great too.

我还有 2013 年初的 MBP 15" Retina,运行 10.8.5 和 i7 处理器 @2.7Ghz,Android SDK 22.6 以及今天早上(03/05/14)更新的所有好东西。API17 将构建具有 HAXM 加速的模拟器,API19 也很好用.

Ditto for my (personal) late 2013 MBP Retina 13" with dual-core i5 and Mavericks.

我的(个人)2013 年末 MBP Retina 13 英寸双核 i5 和 Mavericks 也是如此。

There is something going on for virtualization at the chip level missing from older CPU's (even i7's) that the new API19 x86 images need for HAXM to work. If API19 is not working, give API17 or even 16 a try.

旧 CPU(甚至 i7 的)缺少芯片级虚拟化,新 API19 x86 映像需要 HAXM 才能工作。如果 API19 不起作用,请尝试 API17 甚至 16。

回答by Zouhair Kasmi

On your mac Open the finder then Ctr + Alt + Gafter type this /Users/${yourMacNameHere}/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager

在您的 Mac 上打开查找器,然后Ctr + Alt + G键入此内容/Users/${yourMacNameHere}/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager

your gonna to find installer of the emulator accelerator so run it and set up the memory you need modify it and retry to run your android application

你要找到模拟器加速器的安装程序,所以运行它并设置你需要修改的内存,然后重试运行你的android应用程序

回答by Yogesh patel

if you are running Intel processor make sure HAXM (Intel? Hardware Accelerated Execution Manager) installer is install via SDK Manager by checking this option in SDK Manager. and then run the HAXM installer ext via the path below

如果您运行的是 Intel 处理器,请通过在 SDK Manager 中选中此选项,确保通过 SDK Manager 安装 HAXM(Intel?Hardware Accelerated Execution Manager)安装程序。然后通过下面的路径运行 HAXM 安装程序

your_sdk_folder\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe

also check the ram size allocated while doing HAX installation so it fits the ram size of your emulator.

还要检查在进行 HAX 安装时分配的 ram 大小,以便它适合您的模拟器的 ram 大小。

This videoshows all the required steps which may help you to solve the problem.

视频显示了可能有助于您解决问题的所有必需步骤。

This videowill also help you if you face problem after installing HAXM.

如果您在安装 HAXM 后遇到问题,此视频也将为您提供帮助。

回答by dessertcook

geckob's solution works perfectly. Caution: The HAXM that you provide is used across all running devices. So if you are testing on a phone and Tablet at the same time and each has a requirement of 1G. Then make sure your HAXM alloted is atleast 2G.

geckob 的解决方案非常有效。注意:您提供的 HAXM 用于所有正在运行的设备。所以如果你同时在手机和平​​板上进行测试,并且每个都有1G的要求。然后确保您分配的 HAXM 至少为 2G。