fifth
fifth

Reputation: 4349

Android: Emulator frequently disconnected (offline)!

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?

Upvotes: 11

Views: 20603

Answers (7)

Dave
Dave

Reputation: 7359

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.

Upvotes: 0

Lokesh G
Lokesh G

Reputation: 881

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.

Upvotes: 0

Ben
Ben

Reputation: 57209

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.

Upvotes: 0

ivy
ivy

Reputation: 210

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

Upvotes: 1

CMA
CMA

Reputation: 2808

I have another solution. try this

Run configurations > Target > Wipe user data > Run

Upvotes: 7

CMA
CMA

Reputation: 2808

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

Upvotes: 0

Chris Stratton
Chris Stratton

Reputation: 40337

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

Upvotes: 10

Related Questions