'ERROR Android emulator gets killed
After updating to Android Studio 2 when I try to run my application and choose an emulator, I wait for the emulator to start and it suddenly gets killed. I can see emulator process for some minutes but never the gui. In Android studio I get the error
android studio Error while waiting for device: The emulator process for AVD was killed
This happens even if I run the emulator outside Android Studio. I have tried with both aa Android 6 and Android 4.4 based emulator. Running on a Windows 7 x64 PC. Similar post to another stackoverflow post which was closed. I have tried various ram, vm heap and resolution settings.
Solution 1:[1]
I hit this issue trying to run Android API 30. In the end, I had to upgrade Android Emulator to 30.1.5
(it was 30.1.2
before this).
Solution 2:[2]
I had the same issue, the problem was there is not enough space in my disk drive.. you can see details about your specific situation in layer 'Event Log' this layer regularly is at the bottom on Android studio, it was my output Log:
"02:45 PM Emulator: emulator: ERROR: Not enough space to create userdata partition. Available: 3310.363281 MB at /home/user/.android/avd/my_Nexus_5X_API_27.avd, need 7372.800000 MB."
I had just 7 GB free, so just delete some GB's in my D.D. and it's working fine.
Solution 3:[3]
For me it seems it was a problem that OpenGL didn't work on my machine. I fixed it as follows:
- Go to: Tools > Android > AVD Manager
- Press the "edit" (pencil) icon next to your AVD
- Change "Graphics" to "Software".
Solution 4:[4]
Check the free space of the emulator installation drive is more than 5 GB
Solution 5:[5]
Solution 6:[6]
This worked for me:
Tools -> SDK Manager -> SDK Tools (tab) -> Deselect 'Android Emulator' -> OK
Now, when you try to run your app, or launch device from AVD Manager, it will give the 'Install Emulator' error -> Click Ok. This will automatically download the correct version.
Solution 7:[7]
For Android Studio v4.1 and above:
Menu -> Android Studio -> Preferences -> Tools -> Emulator
Uncheck Launch in a tool window option.
Solution 8:[8]
This issue happens when you have two Android SDK installations on your machine and the environment variable "ANDROID_HOME" points to the wrong location.
To fix it go to Android Studio settings, find the proper Android SDK location, update the environment variable and restart Android Studio / your PC.
Solution 9:[9]
I resolved the same issue by updating the Android Emulator.
Steps:
1. In Android Studio Go to TOOLS
2. SDK Manager
3. Android SDK
4. SDK Tools
5. Update the Android Emulator.
Then it will Run.
Check this for reference https://stackoverflow.com/a/64384372/13952516
Solution 10:[10]
Faced a similar issue, tried the above solutions as well and it didn't work.
Would like to suggest a simple solution which could help if the above suggestions didn't address the issue.
Solution - Try cleaning up space in the system. My problem was I had only 1GB left while trying to launch the emulator after cleaning up space got 8GB and was able to launch the emulator.
Solution 11:[11]
In android studio version 4.0 (WINDOWS), I could find the solution by just checking android studio welcome screen and clicking on the "Events" dropdown AFTER trying to launch the emulator (hence after getting the error):
the events section clearly shows that ANDROID_SDK_ROOT was not set in my system.
In a nutshell, whenever you see such error when starting the emulator, just check the "events" section in the welcome to android studio screen to find the real problem.
Beware that if ANDROID_HOME is not set properly, it will still tell you that ANDROID_SDK_ROOT is broken.
Solution 12:[12]
In my case, after installing the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 (both x86 and x64 version), the issue is solved.
But wait! Why did I know this? I will tell you my experience.
When your program meets a bug, the first thing you need to do is finding the log to debug. But where is the log file that records all the events of the Android emulator? Click Help?Show log in Explorer. And then a new window is oepned, where a file called idea.log is located, and that log file is what we are looking for.
But this file may has recorded too much verbose info, so let's do following processes to get a more simple one:
·Exit Android Studio
·Delete the idea.log
·Open Android Studio
·Click Tools? AVD Manerger
·Start one of emulators you have created, and needless to say, the error will occur again. But the idea.log will be created and the error is recorded into the log file now!
·Exit Android Studio.
·Open the idea.log and begin to analyze it.
·Search "emulator", and in my case there are 2 messages catching my eyes:
INFO - manager.EmulatorProcessHandler - Emulator: E:\cache\SDK\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22
INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code -1073741515 (0xC0000135)
Obviously, the "exit code 1073741515" is something important, and actually many people have asked what it means in StackOverFlow, but unfortunately, I can't find any useful info about it. So let's pass it and focus on the first message.
Open the command line (Press "Win"+"R" ? Enter "CMD" ? Click "OK"), copy the above message E:\cache\SDK\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22
and paste it to the command line. Press Enter.
I totally didn't know what this command meaned, but it's reasonable to deduce that Android Studio ran this command and resulted in the error, so I will try to reproduce the issue.
After that, an error window pop up, saying "...VCRUNTIME140_1.dll is missing...". I know I have been close to the answer. So I serch "VCRUNTIME140_1.dll Missing" on google, and people said that "downloading and installing both the x86 and x64 versions of the Microsoft Visual C++ 2015 - 2019 Redistributable will resolve this problem".
So I download both the x86 and x64 version and install them. After doing this, I run the emulator again, and everything goes well.
Solution 13:[13]
Solution 14:[14]
Please check your free space on your disk also. I had a same problem and finally I got I need to free up space to fix this.
Solution 15:[15]
If you're on the Apple Silicon (M1) chip, make sure you're using an ARM64-based emulator:
If you're not, create a new Virtual Device and use the arm64-v8a
image from Other images.
Solution 16:[16]
- Go to: Tools > Android > AVD Manager and Press the "edit" (pencil) icon next to your AVD , Change "Graphics" to "Software".
- work on my Windows 10 machine and ubuntu 18.04
Solution 17:[17]
If your username is not in ascii/ has spaces then this may help, as I tried all of the solutions here and couldn't fix this problem:
Note: I found this solution on this video, suggested by a user called "tatachka", this is her comment (she kindly let me share it here).
For example, I had this path c:\Users\????.android\avd\Nexus_One_API_24.avd My name in Windows is ????, written in Cyrillic in windows encoding (cp1251). I changed the path to e:\Distribu\AVD.android\avd\Nexus_One_API_24.avd I moved files from disk C there and edited Nexus_One_API_24.ini changing the path in it and everything worked.
How to change the folder path: My computer -> properties -> advanced system parameters -> environment variables - > lower 'New...' button: variable name: ANDROID_SDK_HOME variable value: e:\Distribu\AVD (in my case)
After the reboot, a new folder(.android) appears in the folder e:\Distribu\AVD containing the 'avd' folder
EDIT: For clarification, the idea here is that you don't want the path to have non-ascii characters. I moved it to C:\programs_that_cant_read_hebrew (and preformed the other steps) and it worked just fine.
EDIT: changed "English" to "ascii/ spaces" after the comments
Solution 18:[18]
I get this same error if you upgrade the emulator to version 30+ and run mac < 10.15
You see the real error if you run it from commandline
~/Library/Android/sdk/emulator/emulator -avd
<name>
emulator: Android emulator version 30.5.3.0 (build_id 7196367) (CL:N/A)
dyld: Library not loaded: /System/Library/Frameworks/IOUSBHost.framework/Versions/A/IOUSBHost
You can fix this to upgrade to Big Sur or downgrade the emulator with these steps.
- wget https://dl.google.com/android/repository/emulator-darwin-6885378.zip
- unzip emulator-darwin-5395263.zip
- mv ~/Library/Android/sdk/emulator ~/Library/Android/sdk/previous-emulator
- mv emulator ~/Library/Android/sdk/emulator
- cp ~/Library/Android/sdk/previous-emulator/package.xml ~/Library/Android/sdk/emulator/package.xml
Check if it succeed:
- cd ~
- ~/Library/Android/sdk/emulator/emulator -version
28.0.25.0
- ~/Library/Android/sdk/emulator/emulator -list-avds
Source https://groups.google.com/g/flutter-dev/c/uEthfwjZBAQ/m/HSFqTgYsAgAJ
Edited April 8th 2021: I updated the emulator link to a newer version as mentioned in the comments
Solution 19:[19]
My case was: GOOGLE PLAY.
My virtual device was Pixel 4... As shown on pic, Pixel4 has Google Play support, so that it give this error: " The emulator process for AVD Pixel4 was killed." It gives error on Android Studio 4.1.1.
So that, I created a new virtual device(Pixel 4XL) and selected "SOFTWARE" for emulated performance...
Because this device doesnt have Google Play support, it worked for me.
Solution 20:[20]
goto tools>android>sdkmanager and update emulator and install related API level.It worked for me
Solution 21:[21]
This was working for me. You must update to android studio to latest version and then follow step below to update sdk tool:
Solution 22:[22]
For me it was a problem of available space left in my computer and deleting unnecessary files solved the problem. Causes are vary from situations and you should see event tab which detailed event log are showed.
Solution 23:[23]
To summarize the above:
- Install and reinstall HAXM 7.5.6 (only available version) under 'Android SDK' settings. Try downloading it manually, even other versions (they don't work with Android SDK), installing it from the Android/Sdk folder, etc. sc query intelhaxm in cmd should show if it is running correctly.
- Virtualization is enabled in your BIOS and has been tested
- Made sure the PATH variables are correct (ANDROID_HOME / ANDROID_SDK_ROOT) but NOT (ANDROID_SDK_HOME) to the folder in your settings per Here. Otherwise, you will see EVENTS on the Android Studio splash screen.
- Try unchecking / rechecking Launch in a tool window in Emulator settings (and even Enable Device Frame in AVD settings)
- Try rebuilding in several different combinations of android, different phones, etc (but with same levels and packages ... 30 for example)
- Try Rebooting in several different configurations
- Make sure all SDK Tools are up-to-date, and even try a fresh install of Android Studio. However, tried removing all of them, and adding them back.
- Check your space, try to have 25GB maybe or more free
- Check for Virtual Box, Antivirus Software, etc.
- Open Android Studio with Administrator privileges
RUNNING ON DUAL MONITORS / DOCKING STATION ?
A) Run the emulator with everything unplugged, then plug back in your monitor! (Odd I know)... OR Better yet...
B) Create a New Hardware Profile, which will enable you to change Graphics: Automatic to Software.
Solution 24:[24]
Despite the question has been asked specifically for Windows, i will give my answer for MacOS 11.4 Big Sur, since this thread is the first hit on google, when searching for this issue and none of the answers already given solved the problem for me.
I found the solution to my problem here - for retention reasons, i will repeat the detailed steps anyway:
open
Terminal
and go to the directory/Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/
create an xml file named
entitlements.xml
with the following content:<!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>
resign the emulator
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64
start the simulator
Solution 25:[25]
I know so many people have given answers to this question many have valid points as well. I have tried all the above possible ways, but it was not working, after reading logs from the android studio, I came to know it was a storage issue, for the emulator keep 11 GB space free and it will work.
Solution 26:[26]
- In Android Studio Go to Help -> Show logs in explorer
- Try to run the Emulator again of the errors are as below :
handleCpuAcceleration: feature check for hvf cannot add library vulkan-1.dll: failed cannot add library vulkan-1.dll: failed
- Then install Microsoft VS Code and go to below path
C:\Users<User>\AppData\Local\Programs\Microsoft VS Code
- Copy the vulkan-1.dll and paste in below path
C:\Users<User>\AppData\Local\Android\emulator\lib64
For me this solutions worked
Solution 27:[27]
Simple solution 2021
Solution 28:[28]
For me, just deleting ANDROID_SDK_HOME from the environment variable list solved the problem
Solution 29:[29]
I tried every single answer in here but none of them worked, but finally I got it working when I run it on an emulator device with Android API 28. I think the problem is the emulator device couldn't run Android API 30.
Solution 30:[30]
I think this is problem of Android studio 2 Update or Problem to solve please Update also Android sdk version also then work properly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow