1

Hi I updated the mac os big sur 11.2 to 11.3 today.

I am using Android Studio 4.1.3
Build #AI-201.8743.12.41.7199119, built on March 10, 2021
Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 16

Android Emulator not opening, but it opens in docks from avd manager. I tried Big sur update from Stack Overflow. But it didn't work for me I used command as per given

~/Library/Android/sdk/emulator/emulator -gpu host -feature HVF -avd 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/vmodi/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
added library /Users/vmodi/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/vmodi/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/vmodi/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib

Anyone know how to solve this problem.

Kotlin Learner
  • 3,995
  • 6
  • 47
  • 127

1 Answers1

4

Based on this post this appears to be an issue with some hypervisor entitlements that got updated in OSX 11.3.

Till an official fix is provided in the emulator app, it can be fixed by creating an entitlements.xml file 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 then running

codesign -s - --entitlements entitlements.xml --force ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64

(the path to qemu might need to be adjusted depending on Android SDK's installation path)

This solution was also suggested on other similar posts, I repeated it here for convenience.

Marino
  • 800
  • 1
  • 12
  • 26
  • Any place will work, it makes no difference where the file is saved. The codesign command will just have to be executed from the same directory where the file is – Marino Apr 28 '21 at 08:36
  • thanks once again it really works @Marino – Kotlin Learner Apr 28 '21 at 08:37
  • An update to `emulator` which fixes this issue was released today (version 30.5.6), no need for the above workaround anymore – Marino Apr 29 '21 at 13:06