微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

更新到 MacOS Big Sur 11.3 后,Android 设备管理器无法启动

如何解决更新到 MacOS Big Sur 11.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

(将实际用户名替换为“ Centuryfall”)。

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

解决方法

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


Apple 已更改管理程序权利(权限),弃用 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/

相关问题:

,

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

请按照以下步骤操作:

在您的 android studio 中转到 SDK Manager -> SDK Tools Tab

  1. 选择 Android Emulator 并更新它

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

如果您想继续使用 30.5.6 以下的 Android Emulator 版本 您可以按照已接受的答案 here

中提到的步骤操作 ,

如果您收到 entitlements.xml: cannot read entitlement data 错误,您应该在包含 qemu-system-x86_64 文件的文件夹中启动终端。

例如我的 qemu-system-x86_64 文件在这个位置:/Users/yourusername/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64

现在右键单击 darwin-x86_64 文件夹并单击 New terminal Tab at Folder。不要忘记将您的 entitlements.xml 文件复制到 darwin-x86_64 文件夹中。现在在这个终端中运行@laalto 所说的命令。如果您有任何问题,我会很乐意回答。

,

对于那些使用 Xamarin 的人:

Visual Studio Mac 转到首选项。点击Android,它会提示您进行SDK修复。点击它,它应该修复它。

enter image description here

如果您使用 Rider,请转到 Preference、Android 并更新 Emulator SDK:

enter image description here

,

我今天安装了 Android Studio 并确认仍然需要更新。

使用Tools->SDK Manager->SDK Tools更新两个包。然后制作一个新的模拟器。

现在 emulator --version 显示 30.6.5.0,命令 emulator -avd tak -gpu host 可以毫无问题地启动硬件加速模拟器。

旁注:模拟器输出仍然抛出两个“无法添加库”行,后跟“添加库”,尽管它似乎启动得很好。

附言不要忘记在 .bashrc 或 .zshrc 中设置环境变量

export ANDROID_SDK_ROOT=/Users/dan/Library/Android/sdk
export PATH="$PATH:/Users/dan/Library/Android/sdk/emulator"
export PATH="$PATH:/Users/dan/Library/Android/sdk/tools"

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。