Android Studio Emulator: cannot add library vulkan-1.dll: failed

Viewed 35692

When I run the emulator from Android Studio in Windows 10 Pro 64-bit, then it shows the below error:

13-01-2021
10:42 AM    Emulator: handleCpuAcceleration: feature check for hvf

10:42 AM    Emulator: cannot add library vulkan-1.dll: failed

10:42 AM    Emulator: cannot add library vulkan-1.dll: failed

10:42 AM    Emulator: Process finished with exit code -1073741819 (0xC0000005)

And the emulator is not opening. I've uninstalled the current version (4.1.1) and installed 4.0.1 of Android Studio, but problem is not solved. Now I'm in the latest version of Android Studio i.e., 4.1.1.

Here is output of flutter doctor:

Flutter doctor output Image

12 Answers

I don't know whether Microsoft Visual Studio Code (VS Code) itself needs vulkan-1.dll or any of my following Visual Studio Code extensions,

enter image description here

as I found out that you may find the missing vulkan-1.dll at Visual Studio Code's following folder path:

C:\Users\{your_username}\AppData\Local\Programs\Microsoft VS Code\

So, if you have Microsoft Visual Studio Code installed, you may find the vulkan-1.dll at the above-quoted path. From here, just copy the vulkan-1.dll file, and paste that in folder:

C:\Users\{your_username}\AppData\Local\Android\Sdk\emulator\lib64\

After pasting the file, restart Android Studio and rerun the emulator/AVD.

I have had this problem since update v30.7.5.

I tried this solution:

  1. Create the file ~/.android/advancedFeatures.ini (for Windows users path should be C:\Users<username>.android\advancedFeatures.ini) with the following content:

    Here's how to disable Vulkan apps to talk to the emulator. Add the following lines to ~/.android/advancedFeatures.ini (create this file if it doesn't exist already):

    Vulkan = off
    
    GLDirectMem = on
    

I got the same error yesterday, when I installed the latest version of Android Studio (4.2.2 on the stable channel). Every time I tried to start an Emulator I got a warning saying that "The emulator process for AVD was killed", after looking the IDE's Log, I found this:

2021-07-01 18:00:48,415 [  62545]   INFO - manager.EmulatorProcessHandler - Emulator: cannot add library vulkan-1.dll: failed
2021-07-01 18:00:48,415 [  62545]   INFO - manager.EmulatorProcessHandler - Emulator: cannot add library vulkan-1.dll: failed
2021-07-01 18:00:48,668 [  62798]   INFO - manager.EmulatorProcessHandler - Emulator: emulator: Android emulator version 30.7.5.0 (build_id 7491168) (CL:N/A)
2021-07-01 18:00:48,676 [  62806]   INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code -1073741819 (0xC0000005)
2021-07-01 18:00:48,676 [  62806]   WARN - manager.EmulatorProcessHandler - Emulator terminated with exit code -1073741819

I tried every "solution" I could find but nothing worked until I downloaded vulkan-1.dll and placed it in C:\Windows\System32

Just go to Google and search for vulkan-1.dll file, download it and place it in C:\Windows\System32

Armando's answer is a solution that works. But I don't feel comfortable packing arbitrary DLL files from the Internet into the System32 folder.

However, based on Armando's solution, I have found a way in which I feel more comfortable - however, it remains a workaround:

  1. The "vulkan-1.dll" can be found for example in the software "draw.io" (64 bit). The DLL is available in the installation folder.
  2. Copy the DLL into {ANDROID_HOME}\emulator\lib64\
  3. Start Android Studio and try out the AVD

Error:

  1. Go to Help -> Show Log in Explorer.
  2. Open idea.log file.
  3. Go to the bottom of the file.
  4. Found: "Emulator: cannot add library vulkan-1.dll: failed"

Solution:

  1. Download vulkan-1.dll from this.
  2. Extract and rename dll file names to vulkan-1.dll.
  3. Paste it in C:\Windows\System32

Four steps.

  1. Download the vulkan DLL file from the Internet or get it from any comfortable source.
  2. Extract the DLL file
  3. Place it in c\Users\[your username]\AppData\Local\Android\Sdk\emulator\lib64.
  4. Then rename the file to 'vulkan-1.dll'

Then run your emulator and see it come up.

For me, the solution was as described in this Microsoft forum.

Create a file under your .android directory called advancedFeatures.ini and add these two variables:

Vulkan = off
GLDirectMem = on

More information on Vulkan support for Windows and Linux can be found here.

If you are running xamarin.android in Visual Studio, I strongly recommend uninstall all device simulators and restart Visual Studio and then running your app again.

I have encountered the same problem where emulator.exe ended abruptly with the same lines on the console. After hours of experiment, downgrading the emulator version from Android Emulator 3.7.5 to 30.4.5.0 (build_id 7140946) worked.

I don't think this should be the error vulkan-1.dll is the reason for the process to end abruptly. I am saying this because my logs from a successful run on 30.4.5.0 (build_id 7140946) also showing this dll missing error but continued and the emulator showed up successfully.

emulator: Android emulator version 30.4.5.0 (build_id 7140946) (CL:N/A)
handleCpuAcceleration: feature check for hvf
emulator: WARNING: Your GPU drivers may have a bug. If you experience graphical issues, please consider switching to software rendering.
cannot add library vulkan-1.dll: failed
cannot add library vulkan-1.dll: failed
Failed to open /qemu.conf, err: 2
Windows Hypervisor Platform accelerator is operational
dsound: Could not initialize DirectSoundCapture
dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `goldfish_audio_in'
e:\Users\user\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: warning: opening audio input failed
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `adc'
Your emulator is out of date, please update by launching Android Studio:
 - Start Android Studio
 - Select menu "Tools > Android > SDK Manager"
 - Click "SDK Tools" tab
 - Check "Android Emulator" checkbox
 - Click "OK"

emulator: INFO: boot completed
emulator: Increasing screen off timeout, logcat buffer size to 2M.
emulator: Revoking microphone permissions for Google App.

FYI. I am running an emulator in a nested VM on the Hyper-V platform and my GPU version is:

android_startOpenglesRenderer: gpu info

GPU #1
  Make: 1414
  Model: Microsoft Basic Render Driver
  Device ID: 008c

With the following Android SDK and Tooling:

SDk Tools Setup

SDK Platforms Setup

SDK Folder Structure

I have the above directory structure for the SDK and I have a folder for the vulkan drivers as you can see above. I was able to copy the file: vk_swiftshader.dll to the parent lib64 directory, rename it to vulkan-1.dll to solve the problem

Downgrade the emulator android API version, I was using at API 30 I downgraded it to API28 and emulator starts working

Related