更新到MacOSBigSur11.3后,Android设备管理器无法启动

所以我的 Mac 只是强制更新到 Big Sur 11.3。我一直在尝试访问 Android 设备管理器以运行模拟设备,但每次都无声无息地失败。当我尝试从命令行运行它时,我收到以下错误消息:

emulator @Pixel_3a_API_30
emulator: Android emulator version 30.5.5.0 (build_id 7285888) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /Users/centuryfall/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
added library /Users/centuryfall/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/centuryfall/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
HVF error: HV_ERROR
qemu-system-x86_64: failed to initialize HVF: Invalid argument
Failed to open the hax module
No accelerator found.
qemu-system-x86_64: failed to initialize HAX: Operation not supported by device
added library /Users/centuryfall/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib

(用“世纪秋天”替换了实际用户名)。

我查看了一些其他问题,这些问题说 AVD 需要版本 30。我有 AVD v30.5.5.0 有没有其他人遇到过这个问题?

回答

2021 年 4 月 29 日更新:模拟器 30.5.6 版现已进入稳定频道并修复了此问题。旧答案保留在下面。


苹果已经改变了虚拟机管理程序的权利(权限),贬com.apple.vm.hypervisorcom.apple.security.hypervisor。在 Google 使用新权利修复模拟器代码签名之前,您可以通过自己授予权利来解决该问题。

创建一个entitlements.xml包含以下内容的文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.hypervisor</key>
    <true/>
</dict>
</plist>

并运行

codesign -s - --entitlements entitlements.xml --force /usr/local/bin/qemu-system-x86_64

根据需要替换您的 SDK 所在的 qemu 路径。例如可以~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64在某些 SDK 安装上。

答案基于https://www.arthurkoziel.com/qemu-on-macos-big-sur/

相关问题:

  • https://issuetracker.google.com/issues/181142249
  • https://issuetracker.google.com/issues/186436367
  • Lost only one day trying to get it to work, could be worse lol. Thanks !
  • Yep, that's what needed to happen. Thank you so much!
  • If the above doesn't work, check if you are using the 32bit version of Qemu, then qemu-system-x86_64 should be replaced with qemu-system-i386. Likewise for other architectures.
  • Save my day!!!! Thank you!
  • Cheers, good find!

回答

更新您的模拟器以解决此问题。

请按照以下步骤操作:

在您的 android studio 中,转到 SDK Manager -> SDK Tools 选项卡

  1. 选择 Android Emulator 并更新它

或者

  1. 取消选中 Android Emulator 并应用
  2. 检查 Android Emulator 并申请

如果您想使用低于 30.5.6 的 Android Emulator 版本,您可以按照此处接受的答案中提到的步骤操作

  • This is what did it for me. I already had the latest version of the Android Emulator installed, but removing and re-adding it with these steps resolved the issue

以上是更新到MacOSBigSur11.3后,Android设备管理器无法启动的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>