Android Device Manager fails to launch after updating to MacOS Big Sur 11.3
So my Mac just forced updated to Big Sur 11.3. I've been trying to access the Android Device Manager to run an emulated device and it has been silently failing each time. When I tried to run it from the command line, I get this error message:
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
(Replaced actual username with "centuryfall").
I've looked at some other questions that say that the AVD needs to be version 30. I have AVD v30.5.5.0 Has anyone else had this issue?
Update 2021-04-29: Emulator version 30.5.6 now in stable channel and it fixes this issue. Old answer preserved below.
Apple has changed hypervisor entitlements (permissions), deprecating com.apple.vm.hypervisor
with com.apple.security.hypervisor
. Before Google fixes emulator code signing with the new entitlements you can work around the issue by granting the entitlement yourself.
Create a file entitlements.xml
with the following content:
<?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>
and run
codesign -s - --entitlements entitlements.xml --force /usr/local/bin/qemu-system-x86_64
Replace qemu path as necessary where your SDK is located. Could be e.g. ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64
on some SDK installations.
Answer based on https://www.arthurkoziel.com/qemu-on-macos-big-sur/
Related issues:
- https://issuetracker.google.com/issues/181142249
- https://issuetracker.google.com/issues/186436367
Update your emulator to get rid of this issue.
Follow the steps below:
In your android studio go to SDK Manager -> SDK Tools Tab
- Select Android Emulator and update it
OR
- Uncheck Android Emulator and apply
- Check Android Emulator and apply
If you want to stay with the Android Emulator version below 30.5.6 you can follow the steps mentioned in the accepted answer here
If you get entitlements.xml: cannot read entitlement data
error you should start the terminal at folder which include qemu-system-x86_64 file.
For example my qemu-system-x86_64
file is in this location : /Users/yourusername/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64
Now right click on darwin-x86_64
folder and click New terminal Tab at Folder
. Don't forget the copy your entitlements.xml
file into the darwin-x86_64
folder. Now in this terminal run the command which @laalto said. If you have any question, i'll gladly answer.
For those who using Xamarin:
Visual Studio Mac Go to Preference. Click on Android, it will prompt you for SDK repair. Click on it and it should fix it.
If you are using Rider, go Preference, Android and update the Emulator SDK: