2

I updated today the macOS to Big Sur 11.3, the android emulator can not work any more:

My Computer: Macbook Pro 2019

Android Studio Version: 4.1.3

Android Simulator Version: 30.5.5

Message: The emulator process for AVD xxx was killed.

I tried reinstall the android studio and restart, but the error is still the same. I can not start the android Emulator... :(

Error is here, It somehow related to GLDirectMem/Vulkan:

enter image description here

enter image description here

Do you have idea, how to fix it?

xirururu
  • 5,028
  • 9
  • 35
  • 64

4 Answers4

10

This error occurs because Apple has made changes to the hypervisor entitlements. What you want to do is:

  1. Use /Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64 as the directory for qemu

  2. Add the entitlement to the qemu-system-x86_64 binary by:

    • First create an xml file named entitlements.xml (does not matter where) with this 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>
    
    • Then sign the qemu binary with it:
    codesign -s - --entitlements entitlements.xml --force /Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64
    

For more context, refer here

Jan Kaifer
  • 664
  • 4
  • 18
Mayokun
  • 1,084
  • 1
  • 8
  • 20
  • 1
    I am very confused, this problem I just got after the update to the latest version. Before the update everything was fine util yesterday. However, the solution link you showed me is already nearly 5 months ago... Somehow, my time is slower than the author 5 months... – xirururu Apr 28 '21 at 22:04
4

Check 1:

If you have a Docker installed, stop that. It interrupt the emulator.

Check 2:

Try to launch your emulator from the command line, type:

  1. cd $ANDROID_SDK_ROOT
  2. tools/emulator -list-avds
  3. tools/emulator @name_of_avd -verbose

The ANDROID_SDK_ROOT environment value should point to the android SDK location. You can find this in android studio under the menu tools -> sdk manager.

Check 3:

  1. Delete all AVD's that you currently have.
  2. Go to Preferences >> Android SDK >> SDK Tools
  3. Uninstall Android Emulator
  4. Restart Android Studio
  5. Re-install Android Emulator from the same place.
  6. And finally create a new emulator

Sidenote:

I made a documentation for AMD processors facing emulator issue on Windows systems. Probably something from there could help also. Give it a shot and let me know if it worked. Cheers!

PS: Make sure you installed the latest Vulkan driver for MacOS (Intel CPU) Download the driver from my other Intel documentation or try this usefull post I found.

Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
  • Hi thanks for the answer, but what is vulkan? How can I install it? – xirururu Apr 28 '21 at 21:03
  • I tried to start from console, it reported missing the emulator engine for x86 cpu: ```emulator:Looking for emulator-x86 to emulate 'x86' CPU emulator:Probing program: /Users/yinggu/Library/Android/sdk/tools/emulator64-x86 emulator:Probing program: /Users/yinggu/Library/Android/sdk/tools/emulator-x86 PANIC: Missing emulator engine program for 'x86' CPU.``` – xirururu Apr 28 '21 at 21:07
  • Alright now I know what the problem is. Your Macbook uses an Intel CPU and the acceleration is missing for the Emulator. Please download the vulkan driver from my Link under "PS:" in my answer. Did you tried the written "Checks" before? – Ole Pannier Apr 28 '21 at 21:12
  • I added another Link for macOS I found. Now you should definetely get the problem fixed. :) – Ole Pannier Apr 28 '21 at 21:15
  • I did the all the check 1, 2, 3. Just finished the check 3. After reinstall emulator, it is the same error, so i think, I should install the vulkan as you suggested. Will do it now. :D – xirururu Apr 28 '21 at 21:15
  • I just tried to install the MoltenVK, but too many steps to follow... need to figure out. For short I followed @Mayokun suggestion, solved this problem. Anyway, thanks so much for the help! I think, the installation of the Vulkan should be also a solution. *^_^* – xirururu Apr 28 '21 at 21:55
  • You are welcome. Glad that Mayokun and I could help you! :) – Ole Pannier Apr 29 '21 at 14:02
3

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

Rishabh Saxena
  • 1,765
  • 15
  • 26
1

30.5.6 is out and it works fine. Apparently there has been any incompatibility between 30.5.5 and previous with Big Sur 11.3.