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

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:

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,
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:
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:
The "vulkan-1.dll" can be found for example in the software "draw.io" (64 bit). The DLL is available in the installation folder.
Copy the DLL into {ANDROID_HOME}\emulator\lib64\
Start Android Studio and try out the AVD

Error:
Go to Help -> Show Log in Explorer.
Open idea.log file.
Go to the bottom of the file.
Found: "Emulator: cannot add library vulkan-1.dll: failed"
Solution:
Download vulkan-1.dll from this.
Extract and rename dll file names to vulkan-1.dll.
Paste it in C:\Windows\System32

Four steps.
Download the vulkan DLL file from the Internet or get it from any comfortable source.
Extract the DLL file
Place it in c\Users\[your username]\AppData\Local\Android\Sdk\emulator\lib64.
Then rename the file to 'vulkan-1.dll'
Then run your emulator and see it come up.

look for vulkan runtime installer instead of copying vulkan-1.dll in system32
vulkan.lunarg.com/sdk/home
installer (1Mb)

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.

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

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

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

Related

Android Studio & Big Sur emulator crash on start HVF error?

I have a fresh Android Studio installation (4.1.3) and am having a really hard time getting any emulator to run.
I started off with Android Emulator 30.5.4. This alone did not work, most of the time qemu would lock up on launch (no window, just a frozen icon in the dock). Next I installed Intel x86 Emulator Accelerator (HAXM installer) 7.6.5. This would result in the emulator crashing every time I tried to launch it from the manager.
I toggled graphics from Automatic to both Hardware and Software... yielding the same results.
I then tried what this post suggested: Emulator not starting after updating to Android Studio. Uninstalled HAXM 7.6.5, installed 7.6.6 manually from https://github.com/intel/haxm/releases. Again hit another roadblock.
I have also tried some older build tools (31.0.0), various SDK platforms (Oreo, Nougat, Q), toggling advancedFeatures.ini (HVF, HAXM).
Any suggestion would be greatly appreciated. Would really love to get an emulator running as I don't have a hardware device.
~/.android/avd/Nexus_6P_API_25.avd » ~/Library/Android/sdk/emulator/emulator -avd Nexus_6P_API_25
emulator: Android emulator version 30.5.4.0 (build_id 7243153) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
HVF error: HV_ERROR
qemu-system-i386: failed to initialize HVF: Invalid argument
HAX is working and emulator runs in fast virt mode.
qemu-system-i386: Back to HAX accelerator
added library ~/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
added library ~/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local
This ended up being a duplicate. A workaround is here: Android Emulator 30.4.5 not working on MacOS
macOS 11.3 seems to be the common thread. Side note that was interesting: when I generated my crash reports to send, the GPU would render as UNKNOWN. This is on a 2018 MBP i9 + AMD 560X

Cannot open emulator in android studio

I am using the android studio. I cannot open the emulator from the emulator. When I run the emulator it comes out the error:
Emulator: emulator: ERROR: Unknown AVD name [Pixel_API_27], use -list-avds to see valid list.
Emulator: Process finished with exit code 1
Anyone know how to solve it?
control if you activated virtualization from bios
if you have amd processor you need to follow some steps to use it with full compability, check for that from YouTube.
If you already did those steps, just uninstall all about avd and install them again.
I guess you haven't installed the AVD correctly.
You will see the valid list with:
-list-avds
Or you can install AVDs at Tools > AVD Manager.

Emulator error in starting Androir Studio 3.0.1

I am new with Android Studio (3.0.1) so the first thing i did was creating a new virtual device.
After that, i tried running an app with my new virtual device but it gives me this error :
Emulator: Process finished with exit code 1.
Emulator: emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Can someone tell me what is needed?
Try another version of android studio, maybe your hardware can’t support 3.0.1
I encountered the same problem on 3.0.1 , i've switched to 3.2.0 and it worked.

Emulator: failed to initialize WHPX: Function not implemented

While trying to run the emulator on the android studio I am getting the following error
Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release.
Emulator: failed to initialize WHPX: Function not implemented
Emulator: Warning: requested RAM 1536M too high for your system. Reducing to maximum supported size 512M
Emulator: qemu-system-x86_64.exe: Could not load library WinHvPlatform.dll.
while running the emulator I am getting Notification as
Emulator: Process finished with exit code 0
enter code here
Emulator: failed to initialize WHPX: Function not implemented
This is my first time using the android studio.Please some one help me.
Had the same error that "Emulator: failed to initialize WHPX: Function not implemented"
Updated Android Emulater to latest update and Android SDK Platform-Tools
I found that it was simply not installed, for whatever reason.
To add it to the Android Studio installation, go to Tools->Android->SDK Manager, select the SDK Tools tab, then ensure that Android Emulator is selected.

The emulator process for AVD Nexus_5_API_24 was killed

I have a problems with my AVD. When I try to create a virtual emulator and run it these error pops out:
Cannot launch AVD in emulator.
Output:
Incompatible HAX module version 3,requires minimum version 4
emulator: ERROR: Missing initial data partition file: C:\Users\chuba\.android\avd\Nexus_5_API_24.avd/userdata.img
No accelerator found.
failed to initialize HAX: Invalid argument
Error while waiting for device: The emulator process for AVD Nexus_5_API_24 was killed
Happened to me as well, what fixed it:
Check if Intel HAXM is correctly installed!
Go to:
C:\Users\ADMIN\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager)
Install:
intelhaxm-android.exe
Then try again.
It is about HAX!
easy to solve:
in android studio, go to tools -> SDK manager
find and delete HAX from there
open AVD manager
let android studio to install it again.
These problems occur when a new version is available!

Resources