System Info
MacOs Version - 11.3 Beta
Android Studio Version - 4.1.2
Android Emulator Version - 30.4.5
Android HAXM Version - 7.5.1
Error Stack
emulator: Android emulator version 30.4.5.0 (build_id 7140946) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /Users/rajaparikshit/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.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/rajaparikshit/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/rajaparikshit/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
added library /Users/rajaparikshit/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
Android emulator version - 30.0.26 was running perfectly as expected. But after 30.4.5.0 update its not working.
I tried to search way to downgrade to 30.0.26 but I couldn't find one i.e. there is no any option in android studio manager also.
I saw this SO post. Google store all the emulators version in repository URL - http://dl.google.com/android/repository/ but I didn't know the build version for 30.0.26 version so couldn't go this way.
Update -
Please follow the accepted answer below and do give upvote.
For newbies or if you get stuck at any point please follow the steps:
If you have uninstalled the latest version of emulator as its not working, then please install it again. (Because if we manually replace the emulator directory Android Studio is not able to recognise it and hence you won't able to create/run AVD from Android Studio)
Download the zip file from the URL mentioned in answer.
Copy(Not Move) the content to your original emulator directory.
Restart the android studio if needed.
Still this is just a workaround, actual issue with this new version is still there.
Android Emulator is included with Android Studio. Versions of the emulator prior to 25.3.0 were distributed as part of the Android SDK Tools. To ensure you have the latest version, check the SDK Manager for updates. For Android Emulator versions prior to 25.3.0, see the Android SDK Tools release notes.
For newbies or if you get stuck at any point please follow the steps: If you have uninstalled the latest version of emulator as its not working, then please install it again. (Because if we manually replace the emulator directory Android Studio is not able to recognise it and hence you won't able to create/run AVD from Android Studio)
This update includes support for running the emulator directly in Android Studio and virtual devices with Freeform Window Mode activated by default. The Android Emulator can now be run directly in Android Studio .
Some antivirus software may be incompatible with the Android Emulator. If you're using Avast software and are having trouble running the Android Emulator, try disabling Use nested virtualization when available and Enable Hardware assisted virtualization in the Avast Troubleshooting settings.
Here is the link for the emulator revision 30.0.26 https://dl.google.com/android/repository/emulator-darwin-6885378.zip (taken from this answer)
Download it and then copy over the installed emulator.
It won't work if you have files quarantine enabled; I did so I needed to remove quarantine recursively from downloaded files
xattr -r -d com.apple.quarantine /path/to/dir
Then I can run the emulator by invoking:
emulator @device_name
It doesn't seem to be detected by AS, but works nonetheless.
Below is a temporary fix.
Error:
cannot add library /Users//Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
It seems the dylib file doesn’t exists in the path specified in the error message. However, the library exists in the path below:
~/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
Symlink vaulkan lib to the path emulator is trying to load the library from:
ln -s ~/Library/Android/sdk/emulator/lib64 ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64
Error 2: Then I got an error related to code signing.
HVF error: HV_ERROR qemu-system-x86_64: failed to initialize HVF: Invalid argument
Fix the code signing error:
Step 1:
Create the app.entitlements file for codesigning and add below content (source: https://www.reddit.com/r/VFIO/comments/kdhgni/qemu_hvf_support_for_mac_os_x_bug_sur_hv_error/):
<?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>
Step 2: Perform codesign:
codesign -s - --entitlements ~/<path>/<to>/app.entitlements --force ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64
Launch the emulator:
~/Library/Android/sdk/emulator/emulator -avd Pixel_4_API_30 -gpu auto
Emulator should load without any errors. Hope this helped.
UPDATE: This issue no longer exists in the current version of the emulator. Please refer to @channe's comment to revert the change after upgrading AS/emulator.
I had the same issue on a Mac. I was able to fix it be updating Android Emulator to 30.6.5
from Android Studio -> Sdk Manager -> Android Sdk -> SDK Tools.
Also I had to install Intel x86 Emulator Accelerator (HAXM Installer)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With