Android模拟器由于HAXM而无法工作?

huangapple go评论51阅读模式
英文:

android emulator is not working due to haxm?

问题

我正在尝试在Android Studio上运行Android模拟器,但它始终不断提示说HAXM未安装,并始终提供安装HAXM的选项,我每次都安装了它,然后它显示安装成功,但再次运行模拟器时又显示HAXM未安装。

我尝试了网上找到的所有方法,但模拟器无法启动,一直显示HAXM未安装,但当我尝试安装它时,它显示已经安装。

英文:

I am trying to run android emulator on android studio but it always kept prompting that haxm is not installed and always give option to install haxm and i installed it every time then it shows its successfully done then again when i run emulator it show haxm is not installed.

I tried every thing that I found on internet. But emulator is not starting it kept showing haxm is not installed but when i try to installed it show its already installed.

答案1

得分: 0

  1. 检查是否已安装 sc query intelhaxm
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
指定的服务不存在作为已安装的服务。

服务未安装,需要安装

  1. 安装 haxm-7.8.0-setup.exe,我从 https://github.com/intel/haxm/releases 下载了

  2. 检查是否已安装 sc query intelhaxm

SERVICE_NAME: intelhaxm
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 31  (0x1f)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

如果它像这样运行,它将要求停止 Hyper-V。

  1. bcdedit /set hypervisorlaunchtype off
    操作已成功完成。
    它还会要求重新启动以使禁用操作生效。

  2. 重启
    再次查询服务状态

  3. sc query intelhaxm

SERVICE_NAME: intelhaxm
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

从 Android SDK 检查

  1. Android\Sdk\emulator>emulator-check.exe accel
    accel:
    0
    HAXM 版本 7.8.0 (4) 已安装并可用。

运行带有内核日志的仿真后

  1. 在 qemu 日志中我看到 4 个遭遇
8.1. VERBOSE | CPU Acceleration status: HAXM version 7.8.0 (4) is installed and usable.
8.2. INFO    |   argv[16] = "-enable-hax"
8.3. INFO    | Concatenated QEMU options: "lala;a-bla-bla-bla pstore.bin -cpu android64 -enable-hax 
8.4. HAX is working and emulator runs in fast virt mode.

希望这对你有所帮助。
附言:有时我必须从 Studio 运行仿真器两次才能启动,否则没有问题...

英文:

I can not say what you did. Bu what is what I did for it to work.
As admin from command prompt

  1. check if installed sc query intelhaxm
    <!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:

The specified service does not exist as an installed service.

<!-- end snippet -->
Service not installed, need to install

  1. install haxm-7.8.0-setup.exe. I downloaded from https://github.com/intel/haxm/releases

  2. check if installed sc query intelhaxm

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

SERVICE_NAME: intelhaxm
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 31  (0x1f)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

<!-- end snippet -->

It will say to stop Hyper-V if it works like this.

4.bcdedit /set hypervisorlaunchtype off
The operation completed successfully.
it will also ask to restart for disable operation to to take effect.

  1. restart
    Query againg for service state

  2. sc query intelhaxm
    <!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
<!-- end snippet -->
From android SDK check
7. Android\Sdk\emulator>emulator-check.exe accel
accel:
0
HAXM version 7.8.0 (4) is installed and usable.
accel
After runnin an emulation with kernel logs

  1. I see in qemu logs 4 encounters
    >8.1. VERBOSE | CPU Acceleration status: HAXM version 7.8.0 (4) is installed and usable.
    >8.2. INFO | argv[16] = "-enable-hax"
    >8.3. INFO | Concatenated QEMU options: "lala;a-bla-bla-bla pstore.bin -cpu android64 -enable-hax
    >8.4. HAX is working and emulator runs in fast virt mode.

I hope it helps.
p.s. someone I had to run emulator from Studio twice for it to kick in otherwise no issues...

huangapple
  • 本文由 发表于 2023年7月17日 16:00:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76702501.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定