Andreas Oikonomou
Andreas Oikonomou

Reputation: 3277

ERROR Android emulator gets killed in Android Studio

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 the emulator process for some minutes but never the GUI. In Android studio, I get the error

android studio Error while waiting for the device: The emulator process for AVD was killed

This happens even if I run the emulator outside Android Studio. I have tried both an Android 6 and an 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.

Upvotes: 306

Views: 617138

Answers (30)

Skander Hamdi
Skander Hamdi

Reputation: 141

In my case, I'd to free some space in my hard drive (5 GB).

Upvotes: 1

David Hackro
David Hackro

Reputation: 3712

The best to discover the issue is looking the log

cd /Library/Android/sdk/emulator/
./emulator  -list-avds
./emulator @name-emulator

https://medium.com/nerd-for-tech/how-to-downgrade-android-emulator-on-macos-6e611d2d2bcb

Upvotes: 0

Jamal N
Jamal N

Reputation: 638

This problem has occurred to me when I changed my SDK location from a disk to another disk, due to limited disk space problem, while doing this some files may got corrupted or lost, after a bit of digging I found out that my SDK was partially installed(according to the SDK manager). All I have to do to solve this problem was to redownload the rest of the files from the SDK manager.

Upvotes: 0

Alexander Terp
Alexander Terp

Reputation: 425

For me (and I saw online a few others ran into this), it was because I had Riot's Vanguard software running in the background. It wasn't enough to kill the process in the tray (I'm on Windows), I had to set it to not run on startup and then restart my computer. After that, I was able to launch my virtual device just fine.

Upvotes: 0

cm101
cm101

Reputation: 386

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:

  1. open Terminal and go to the directory /Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/
  2. create an xml file named entitlements.xml with the following 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>
  1. resign the emulator

codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64

  1. start the simulator

Upvotes: 6

mightyandweakcoder
mightyandweakcoder

Reputation: 846

I solved this problem by killing the emulator qemu-system-x86_64 in Windows Task Manager. Even though the emulator may not be open but it was still running in Task Manager. Killing the emulator and then running a cold boot from the AVD manager worked perfectly.

Upvotes: 1

XpressGeek
XpressGeek

Reputation: 3677

I faced the similar problem. After searching for actual problem I found that my OS drive space (for Windows : C drive) where I installed Android Studio and SDK is running very low. At that time my C drive had only 1GB left. As per I know, android emulator won't run if the drive has less than 5GB of free storage, So I cleared my C drive by deleting unnecessary data and freed 25GB of space. Now I am able to run virtual emulators without facing any problem.

Upvotes: 1

Gevorg Gharibyan
Gevorg Gharibyan

Reputation: 231

You need to update the following tools.

Upvotes: 13

chileshe
chileshe

Reputation: 56

After 2 days of trying all the suggested solutions and other sources. None worked for me. It turned out I needed to enable virtualization support for windows using the add feature tool on windows os. Just got to your control panel and search for "Add feature" See attached image. All the bestSelect Virtual Machine Platform as well as Windows Hypervisor Platform

Upvotes: 1

Jonathan Marin
Jonathan Marin

Reputation: 2519

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.

Upvotes: 238

Michael Osofsky
Michael Osofsky

Reputation: 13115

If using a Mac Intel Core i7, choose "x86" as the ABI. On the Virtual Device Configuration screen, there are three tabs:

  1. Recommended
  2. x86 Images
  3. Other Images

Tabs 1 and 2 will most likely have the appropriate ABI for your computer. But I once mistakenly went to Other Images and choose an ABI of arm64-v8a.

This answer is similar to https://stackoverflow.com/a/66059850/2848676 except it's for a Mac running Intel instead of Apple Silicon (M1) chip.

The generalization of both answers is to make sure the ABI you choose is compatible with your computer. For example, on my "Other Images" tab it explicitly warned me "Consider using an x86 system image on an x86 host for better emulation performance" but unfortunately I didn't see this warning until later when I was trying to fix my problem.

Upvotes: 1

Karthikeyan Ganesan
Karthikeyan Ganesan

Reputation: 2035

Go to C:\Users\{{USERNAME}}\.android\avd and remove the folder of avd target device and create a new virtual device in AVD manager. Now you click the run button. That's it

Upvotes: 1

Bacar Pereira
Bacar Pereira

Reputation: 1145

Simple solution 2021

  1. Go to AVD Manager enter image description here

  2. Find the emulator you are trying to use and then click on the down arrowenter image description here

  3. Select the option Show on Disk

  4. delete every file that ends with .lockenter image description here

  5. Runs again the emulator and after this will initialize

Upvotes: 10

AmanDeepSharma
AmanDeepSharma

Reputation: 2208

Please check your .zshrc file in Mac (edit it by usign vim ~/.zshrc command) and remove any manually added path to ANDROID_HOME.

If you are not using .zshrc file then it may be .bashrc file.

Once removed restart your Android Studio and avd. This worked like a magic!!

Upvotes: 1

I also had problem like this.

fix:

  • 1. Choose one of the older version for Android VDM(System image) - first,I used a version 28(It was OREO in my case) after that I switched to older one , to 25(NOUGAT).

  • 2. Change "Graphics" to "Software".

Upvotes: 3

Prahlad Awasthi
Prahlad Awasthi

Reputation: 288

  1. In Android Studio Go to Help -> Show logs in explorer
  2. 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

  1. Then install Microsoft VS Code and go to below path

C:\Users<User>\AppData\Local\Programs\Microsoft VS Code

  1. Copy the vulkan-1.dll and paste in below path

C:\Users<User>\AppData\Local\Android\emulator\lib64

For me this solutions worked

Upvotes: 5

Lee Michael
Lee Michael

Reputation: 51

I tried all the answers above, and none of them work. I eventually fixed the issue by doing the following:

  1. open SDK manager
  2. under SDK platform, uncheck all checked package, hit ok
  3. open AVD manager, click the download button next to your virtual device
  4. launch the device, this should be able to fix the issue
  5. reopen SDK manager and recheck your desire platform

that's all!! hope this helps you as well, cheers

Upvotes: 3

Imtiyaz Khalani
Imtiyaz Khalani

Reputation: 2053

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.

Upvotes: 6

sudhanshu
sudhanshu

Reputation: 479

I also get this issue. Working solution is. Android Studio File-->Settings--> search for Emulator. uncheck "Launch in tool window" option. enter image description here

Upvotes: 1

Sang Nguyen
Sang Nguyen

Reputation: 123

Go to setting avd, change "Graphics" from "Quick boot" to "Cold boot". enter image description here

Upvotes: 1

Adam Kis
Adam Kis

Reputation: 1522

If you added these into ~/.zshrc (or ~/.zprofile, ...) in MacOS:

export ANDROID_SDK_ROOT=...
export ANDROID_SDK_HOME=...

it can cause this error.

Remove or comment these lines then restart Android Studio and it'll work.

Upvotes: 2

Morpheus
Morpheus

Reputation: 572

qemu-system-x86_64 kill this process on windows task manager it stay running even close the emulator. this process cause terminate the new process on start. The process name maybe different depend upon which System image you are using following possible process name

 - qemu-system-i386.exe
 - qemu-system-aarch64
 - qemu-system-armel
 - qemu-system-x86_64

kill one of them or all of them fix the issue

Upvotes: 1

user3658510
user3658510

Reputation: 2347

This error is so generic that this symptom could be because of any one of a million completely different problems. What you have to do is to find more info about what is happening, so you don't look like a blind chicken pecking at unappetizing rocks. So lets us get the debugging steps:

  • first thing is to find the logs of Android studio. In doubt, stackoverflow already has a section to help you How to find the logs on android studio?. The text file should be named: "idea.log". You can open it with notepad, but only open it after android studio is closed (in windows 10).

  • There will be a lot of events inside. Search by "manager.EmulatorProcessHandler" and the last date that you had the error. A good trick to facilitate your life, after having found the log file, is to close Android studio: delete the log file; reopen android studio and retry to open the emulator. The log file will be recreated with a lot less history and so it will be so much easier to search.

  • In my case, i found: manager.EmulatorProcessHandler - Emulator: emulator: ERROR: Another emulator instance is running. Please close it or run all emulators with -read-only flag.. Given that, it is easy to solve. I just had to open a process manager and terminate the emu process that didn't correctly close for some unknown reason.

  • Of course, in our case the log will be completely different. But now you have a clue of the hidden criminal.

Upvotes: 3

林果皞
林果皞

Reputation: 7793

You can get the error message details by running emulator from command line, e.g.:

C:\WINDOWS\system32>C:\Users\foo\AppData\Local\Android\Sdk\emulator\emulator -netdelay none -netspeed full -writable-system -avd emulator_foo
emulator: Android emulator version 30.6.5.0 (build_id 7324830) (CL:N/A)
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-ranchu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is undefined

Or alternatively via Android Studio IDE menu Help -> Show Log in Explorer -> open idea.log file -> run avd emulator again to see the error log updated in last few lines.

Upvotes: 1

ke Chankrisna
ke Chankrisna

Reputation: 301

This was working for me. You must update to android studio to latest version and then follow step below to update sdk tool:

  1. Tools -> SDK Managers
  2. Select Android SDK
  3. Tab on SDK Tools
  4. Check to update options available.enter image description here
  5. Press ok button After that this procedure will take you some minutes, after it completed, everything will works fine.

Upvotes: 6

Arka Prava Basu
Arka Prava Basu

Reputation: 2560

On my Pop OS 20.04 LTS I got this when graphics drivers were updated but a system restart is pending. Upon a full system restart emulator images were working fine.

PS. On my machine whenever graphics drivers are updated system needs to be restarted otherwise some applications like Zoom and in this case Android emulators start crashing unexpectedly.

Upvotes: 1

SudhakarH
SudhakarH

Reputation: 551

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

Upvotes: 27

umer farooq
umer farooq

Reputation: 183

If from above no solution worked. Then download both the x86 and x64 version and install them. After doing this, run the emulator again, and everything goes well.

Download link is : https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0

Upvotes: 1

Yat3s
Yat3s

Reputation: 330

My tricky solution is to try to start another emulator, then start this broken emulator.

In my case(A Main 256 Heap is broken), I will start A Main 512 Heap, then start A Main 256 Heap

enter image description here

Upvotes: 0

viper
viper

Reputation: 1906

I ran into the same problem. Tried different solutions as mentioned like

  • Changing "Graphics" to "Software"
  • Updating android studio sdk to latest release
  • Invalidate cache/restart android studio

But the issue was my disk was full which and the emulator couldn't save the necessary files. So if anyone faces this issue, please make sure you have at least 10GB free space (as for android 11 installation in pixel 4 2021)

Upvotes: 2

Related Questions