boston
boston

Reputation: 355

Android emulator not starting at all

Today I tried to launch my Android app from within eclipse but nothing happened. Everything worked fine yesterday. I tried a few things like adb kill-server, adb-start-server. At some point I got the "user data image is used by another emulator" error, so I went about deleting the .lock folders in the avd image but to no avail.

I created a new avd and the emulator doesnt even start with this image. I tried to start it with

emulator -avd avdname

->nothing. No error. emulator.exe is running in Taskmanager.

Windows 7 Android SDK Tools, revision 7

Update: Now I know when I get the error

emulator: ERROR: the user data image is used by another emulator. aborting

it's when I try to run the application again after the emulator.exe is already dangling in Taksmanager.

Update: waited for 20mins. emulator.exe is just sitting there with 00:00:00 cpu time.

Upvotes: 25

Views: 96272

Answers (25)

Georgy  Ivanov
Georgy Ivanov

Reputation: 35

Had the same issue and find out that AVD not working without Microsoft Visual C++ 2015-2022 Redistributable (x64)

After installing Microsoft Visual C++ 2015-2022 Redistributable (x64) everithing works fine. AVD runs well.

Upvotes: 0

Emanoel Loreto
Emanoel Loreto

Reputation: 1

[Device doesn't open] [Windows "N"]

My virtual Devices from Android Studio stopped from working after I installed an "N" Windows 11 Iso, which comes without Windows media feature, after trying a lot of stuff, the only thing that worked for me was installing the Media Feature Pack

U can install it with the following steps:

Settings > Search for "Optional Features" > Add an optional feature > Search for "Media Feature Pack"

In windows 10, u can download direct from the web

Upvotes: 0

RohitD
RohitD

Reputation: 21

I tried the kill adb-server and start adb-server approach but it didn't work. I deleted my AVD and created a new AVD with the same configuration, and it worked. Hardly took 30 seconds.

Upvotes: 2

stream28
stream28

Reputation: 141

Enabling software graphic support instead of hardware worked for me.

Upvotes: 4

Josh Liu
Josh Liu

Reputation: 476

After trying many solutions that didn't work for me, I finally found one that solved mine.

The problem is my ANDROID SDK is not stored in the default location which is in D:\<A_folder>

I tried to run emulator -avd <avd_name> and resulted in an error that it can't find ANDROID_SDK_ROOT.

Solution:

Add ANDROID_SDK_ROOT to system env with the value of the ANDROID SKD folder location

Side note: If you don't know the avd name, you can run emulator -list-avds to list all the available avds enter image description here

Upvotes: 1

Hyung Tae Carapeto Figur
Hyung Tae Carapeto Figur

Reputation: 1533

What solves my problem is going to the emulator device folder and deleting all the "image" files.

Upvotes: 0

Lei Zhang
Lei Zhang

Reputation: 634

It happened to me after the Mac upgraded to Big Sur 11.5.2. Then I followed the link below resolved the issue. https://exerror.com/solved-qemu-system-x86_64-failed-to-initialize-hax-operation-not-supported-by-device-in-big-sur/

Apple has made changes to the hypervisor entitlements. They are key-value pairs that grant executable permission to use a service or technology. Create and put the entitlements.xml in the folder of darwin-x86_64 below and run the command at the folder, it should work.

codesign -s - --entitlements entitlements.xml --force /Users/username/Library/Android/sdk/emulator/qemu/darwin-x86_64/

enter image description here

and the content of entitlements.xml

<?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>

Upvotes: 0

xjcl
xjcl

Reputation: 15309

I am using Linux and I found that running VirtualBox (with Windows) makes the Android Emulator fail silently. They are probably locking each other out of using virtualizaton, so the solution is to shut down any other virtual machines and remove all *.lock files.

Upvotes: 1

Sagar Shah
Sagar Shah

Reputation: 4292

I want to run my apps on Android 11. So I downladed api 30 and started Emulator with recommended configuration.

But Emulator just exit with code 1 and not able to launch at all.

So after having few hours of spending time, I got SUCCESS after 2 steps.

  1. I did updated the Android emulator from SDK Tools.
  2. And Install x86 HAXM Installer and also manually install this exe file (haxm-7.6.5-setup) at following path:

C:\Users\HOME\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager

That's it.

Upvotes: 1

Baala
Baala

Reputation: 481

Faced a similar issue, mine was due to a space issue as the emulator wasn't able to launch.

Solution - Cleaned up system space and was able to launch the emulator

Upvotes: 2

ireshan pathirana
ireshan pathirana

Reputation: 443

It's not working sometimes when your disk free space ran out. Check that as well. My issue was lack of empty disk space.

Upvotes: 1

Ali &#214;zyer
Ali &#214;zyer

Reputation: 11

firstly get name of your SDK's with

emulator -list-avds

Then you run command emulator -partition-size 512 -avd avd_name as carolnogueira recomended

for me it was not enought disk space, and after clear some unnecessary files, it worked fine

Upvotes: 1

Shivam Dawar
Shivam Dawar

Reputation: 553

May be you have created a new device that causing problem to start AVD. Delete that device and all will work fine.

Upvotes: 0

Asbar Ali
Asbar Ali

Reputation: 995

I faced a similar issue because there was not enough space in disk. So I deleted unwanted stuff and it worked for me.

Upvotes: 0

Henning Hall
Henning Hall

Reputation: 1457

I got it to work by doing the following:

  1. Right click on emulator in list.
  2. Select Wipe Data

Upvotes: 1

Steven Spungin
Steven Spungin

Reputation: 29081

I had this issued after upgrading Android Studio.

  • Open the AVD manager
  • Open the context menu for your image. (right click)
  • Select Cold Boot Now

ScreenShot

Upvotes: 16

tonisives
tonisives

Reputation: 2510

For me the problem was that I ran android studio from terminal, with root.

When I opened studio normally from the applications folder and created a new AVD(the root one was not present), the AVD started.

Upvotes: 1

carolnogueira
carolnogueira

Reputation: 499

I had a smiliar problem in MacOS Sierra 10.12.4 and Android Studio 2.3.1.

I tried everything, I uninstalled and reinstalled Android Studio, rebooted the computer, cleared the .android folder and created a new avd image. Nothing helped me, but finally I ran this command (See more in Android Documentation):

emulator -partition-size 512 -avd avd_name 

And I received this error:

emulator: WARNING: encryption is off
Hax is enabled
Hax ram_size 0x40000000
HAX is working and emulator runs in fast virt mode.
Failed to sync vcpu reg
Failed to sync vcpu reg
Failed to sync vcpu reg
Failed to sync HAX vcpu contextInternal error: Initial hax sync failed 

With that, I discovered that my solution was to stop Docker-Machine, and, like magic, it solved the problem.

Upvotes: 17

Ashitakalax
Ashitakalax

Reputation: 1557

After updating to windows 10 my graphics drivers started acting weird.

Disable the "Use Host GPU"

enabled the emulator to start for me

Upvotes: 1

Binod Rokka
Binod Rokka

Reputation: 869

most often deleting .android folder in user make the sense but

unbeleivable ,some of these types of problem may due to display drivers.. try switching drivers to dedicated graphics or reinstall main driver.. ...

Upvotes: 1

HimalayanCoder
HimalayanCoder

Reputation: 9850

In linux:

Go to to your home directory

$cd ~/.android/avd 
$ls
$NexusS.avd/  NexusS.ini
$rm *.ini
$rm -rf NexusS.avd/      (don't use sudo and use TAB to bring in Nexus avd directory)

Restart eclipse and create new AVDs

Windows users should do the same in their user directory i.e C:/Users/FooBar/android/avd

Upvotes: 2

user1908637
user1908637

Reputation: 71

Well, I came across the same issue, I spent several hours uninstalling, re-installing, the DSK tools, and Eclipse individually, and also messed with the Bundle and the VM was simply not launching. Previous to that, I created a virtual machine, and worked fine for a day. What I did, was simply erased the .android folder from the C:\Users\USER\ folder and created a new virtual machine. It worked without any problems since then.

Upvotes: 7

user1207965
user1207965

Reputation: 139

Or : Window ->AVD Manager -> pick your virtual device ->Edit-> Snapshot(make sure is disabled) ->Edit AVD (try again, if still not working , then try to launch the emulator directly from AVD Manager -> Start).

Upvotes: 4

Ray
Ray

Reputation: 787

I faced with similar issue and something that worked for is, run the android virtual device manager and when you launch your AVD, remove the check start from the last snapshot.

I did this and it worked for me.

Upvotes: 1

Jimmy
Jimmy

Reputation: 16428

When you say, "Everything worked fine yesterday", you should first ask yourself what you have changed since; have you installed anything that could interfere with the emulator?

Personally, I would download a fresh copy of the Android SDK, remove the reference to the currently installed version from your PATH, and add the new one.

I should think that would solve your issue (at least, being able to start an AVD that is).

One more thing to note is that the AVD can sometimes be quite slow to startup. On one of my machines, it has taken up to 7 minutes to boot up. So try emulator -avd avdname, then go make a coffee and see if it works when you return :)

Good luck!

Upvotes: 7

Related Questions