10

Sometime just after I launched a new emulator, for very first time I was trying to upload my apk, however I got "emulator: ERROR: the user data image is used by another emulator. aborting".

I launched a new emulator, and left it alone, several minutes later, DDMS showed "device offline".

I had to restart a new one, you know, minutes wasted.
It's really bothering that I keep getting this error and slowed down debugging.
How do I fix it?

ElGavilan
  • 6,610
  • 16
  • 27
  • 36
fifth
  • 4,249
  • 9
  • 45
  • 62
  • 1
    Have you searched StackOverflow? Here are some similar posts: (http://stackoverflow.com/questions/2333273/emulator-5554-disconnected) (http://stackoverflow.com/questions/1740834/emulator-problem-in-android) – Mudassir May 16 '11 at 05:56
  • 1
    Of course I did search over here, however all answers on StackOverFlow can't solve the problem once for all, I kept getting this... And deleting lock files was time consumed, gotta restart emulator – fifth May 16 '11 at 08:09

7 Answers7

10

If the emulator is still alive, you can tell adb to connect to it via tcp (which is I believe what it does anyway, only it normally uses an 'emulator' class of name and would now get a ip:port one)

It's been a while since I've had to do that, but I think that if you were using emulator-5554 you would connect to your development machine's loopback one port higher, ie:

adb connect localhost:5555

If it works adb devices will show it an eclipse should see it as a deployment option

The 'in use' problem sounds like a stale lockfile perhaps left behind in a crash

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • 1
    with android-19 and x86-64 the problem (offline even for tcp connects) here is random. I needed to write a wrapper that restarts the emulator until it gets a connection......... to me it looks like a bug which is unsurprising if you know how plenty the bugs are in the image. – user1050755 Jun 25 '14 at 09:43
  • again I got this error: "ddmlib: An established connection was aborted by the software in your host machine" – garish Oct 02 '15 at 08:19
7

I have another solution. try this

Run configurations > Target > Wipe user data > Run

CMA
  • 2,758
  • 5
  • 28
  • 40
  • Good one. If netstat -t doesn't show any socket open in tcp and port 5554 or 5555, wiping the user data is the solution. – Adrián Pérez Sep 09 '13 at 08:06
  • 1
    Thanks a lot mate ! you literally saved my day ! I was searching so many solution nothing worked...But yours did.The answer should deserve more up votes ! – Shravan Jan 31 '15 at 15:30
1

In my case it happens when I have another process listening on emulator port.

e.g. if I see:

emulator-5554 offline

it means that something is using port 5554

ivy
  • 210
  • 1
  • 2
  • 14
0

On Arch Linux x64, I had this similar problem which led me to this question. Using Eclipse, the emulator-5554 window would freeze, and Eclipse prompted me to start a new one. In the following dialog, emulator-5554 was reported to be offline, with an unknown target. If I started a new instance, it would be emulator-5556. This problem persisted through Eclipse restarts and log-off-on cycles too! Further, killx would close the window, but the process was still running.

So, find the emulator64-arm process id (not emulator-arm!):

ps ax | grep "emulator64-arm"

...and then just kill -9 it:

sudo kill -9 6728

...where 6728 was its PID. This completely disconnects the emulator so Eclipse can try to run it again.

Ben
  • 54,723
  • 49
  • 178
  • 224
0

type "monitor" command in cmd,then select device in the monitor window click on down arrow as  just click on reset tab thats all you will get internet connection Open android debug monitor window by typing "monitor" command in cmd, then select device in the monitor window, click on down arrow as shown in the figure then just click on reset tab thats all you will get internet connection.

Lokesh G
  • 831
  • 11
  • 19
0

It was some strange

I had that problem, automatically stopped the emulator localhost:5554 after to launch the application.

I didn't know why it happens but intil today I did something different at I could launch as normality.

What I did as different was to change the prespective of Eclipse ADT. I was executing the application from Debug and now I executed from Java Prespective, it worked, I don't know the reason, I had to share it, sound some .. this answer but I resolved doing that without deleting and creating again my android virtual device.

Dave
  • 7,028
  • 11
  • 35
  • 58
0

Manually delete these following folders:

C:\Users\%UserName%.android\avd\AVD2.1.avd\cache.img.lock

C:\Users\%UserName%.android\avd\AVD2.1.avd\userdata-qemu.img.lock

this always works for me. :3

CMA
  • 2,758
  • 5
  • 28
  • 40