Android emulator-5554 offline
Asked Answered
S

48

217

I'm having a problem with emulator-5554, it keeps telling me it is offline.

When I do a adb devices from the command line it says

emulator-5554 offline

Even after a fresh restart, I try that command and it still says it is offline.

The problem is when I try to install .apk files to the emulator using abd install <path> from the command prompt, it tells me that it is offline, if I create another device and run that one, then try to install the .apk files, it says I have too many devices connected. So in other words, I can't install my .apk files.

How can I get rid of that emulator-5554? I heard that if you do a restart, it should clear all the devices, but that does not seem to be working. It is like it is getting initialized when my computer starts up. Has anyone run into this issue?

Thanks

Shostakovich answered 30/6, 2010 at 19:25 Comment(6)
In order to determine whether the problem is the emulator try this: 1. Open an emulator. 2. Open another emulator. 3. adb devices to get the emulators' names. 4. Try to install the APK by excecuting: adb -s NAME_OF_DEVICE install file.apk 5. Tell us what happens.Disband
I will give that a try when I get home (at work right now), I didn't know you could specify the device you want to install on. That should be really helpful. I will update in a few hours. thanks for the reply!Shostakovich
Thanks again for the comment. I was able to install the apk on the emulator doing what you said. The disconnected one still remains on my devices list, but all I wanted to do was install that .apk. Thanks again, it worked!Shostakovich
I think this question is related to: #6014124 Try to have a look at this thread.Worm
This doesn't answer your question, but might solve your problem - adb -d specified usb devices rather than emulators, adb -e emulators rather than usb devices, and adb -s NAME I think can be used to specify specifically which device you want, though I'm unclear on whether the last one always works the way you think.Accused
Go into Android Device Manager and stop emulator and right click and click factory reset.Mandymandych
S
102

In such a case, you can do all of the following in order to be assured that your emulator starts working again :

  1. Go to cmd and type adb kill-server
  2. Go to task manager and find adb in processes. If you find one, right click on it and click on end process tree.
  3. In eclipse, go to Window>Android Virtual Device Manager, click on the AVD you want to launch, click on start and uncheck "Launch From Snapshot" and then click on launch.

That's it! It will take a while and it should resolve your problem.

Sanity answered 24/1, 2014 at 10:27 Comment(5)
This also worked for me (killing ADB didn't solve my problem, in any situations).Armenta
as soon as i killed that process tree, the adb running devices list cleared :) it worked. <3 thanksLinson
In Android Studio, to change the virtual device Boot Option from Quick Boot to Cold Boot works for me.Hourglass
Where can I find the "Launch From Snapshot" setting in Android Device Manager when I execute it from Visual Studio 2019?Gastrula
Only full unistall of emulator and XAML worked in my case. Google becomes too lazy to check each buildCognizance
J
183

1 . Simply "Wipe data" to fix this issue.

enter image description here

2 . If it doesn't work, go to emulated device and enable developer options > enable usb debugging

Jumbala answered 18/3, 2017 at 15:57 Comment(7)
Uninstalling the app from the emulator did the trick for me. But it is the same idea as wiping the dataBannock
This helped ind combination with 'Cold Boot now' just below 'Wipe Data'.Oskar
Just enabling usb debugging and a cold boot was enough.Thadeus
This screen is from Tools - AVD ManagerDowson
cold boot + usb debugCochard
It might be due to the fact that i've recently enabled and then disabled developer mode on this emulator device. If I disable debugging after that I cannot see logsCochard
In my case I just deleted all emulators in android studio then restart the PC and it worked. I'm using a real deviceTittivate
S
102

In such a case, you can do all of the following in order to be assured that your emulator starts working again :

  1. Go to cmd and type adb kill-server
  2. Go to task manager and find adb in processes. If you find one, right click on it and click on end process tree.
  3. In eclipse, go to Window>Android Virtual Device Manager, click on the AVD you want to launch, click on start and uncheck "Launch From Snapshot" and then click on launch.

That's it! It will take a while and it should resolve your problem.

Sanity answered 24/1, 2014 at 10:27 Comment(5)
This also worked for me (killing ADB didn't solve my problem, in any situations).Armenta
as soon as i killed that process tree, the adb running devices list cleared :) it worked. <3 thanksLinson
In Android Studio, to change the virtual device Boot Option from Quick Boot to Cold Boot works for me.Hourglass
Where can I find the "Launch From Snapshot" setting in Android Device Manager when I execute it from Visual Studio 2019?Gastrula
Only full unistall of emulator and XAML worked in my case. Google becomes too lazy to check each buildCognizance
C
47

The way that Android detects emulators is by scanning ports starting at port 5555.

The number you see in the adb devices list (in your case 5554) will be one less than the port that adb is finding open.

You probably have a process running that is listening on port 5555. To get rid of the "offline" device, you will need to find that application and close it or reconfigure it to listen to a different port.

Copycat answered 27/4, 2012 at 19:18 Comment(8)
The question was about ADB. ADB port numbers start at 5555.Copycat
"You probably have a process running that is listening on port 5555". This really helped as we were running another server on that port and had totally forgotten about it!Plastid
It always started on 5554 - on all my PCs (home and work ones)... and it's always EVEN (5554, 5556, 5558, 5560, ...) while using multiple emulators.Sanitize
Frank, why do you think they're all even? It's because Android also uses the odd numbered ports in between.Copycat
This helped me too! I had a port open on 5555 which shows up as emulator 5554 (?). Everyone who has already tried nonworking"reboot the server" style answers should go ahead and portscan their localhost. I assumed ADB would be using USB devices more directly, not looking at my local ports and making assumptions about there being an emulator there without even doing a protocol check.Ransome
Many thanks,also fix my problem. I can not belevie there is a qemu process occupy the port.Silvern
Thank you, lsof -i tcp:5555 helped me to kill right processThermo
For me Tabnine was running on 5555 changed the port now I have no problem thanks!Middlesworth
C
42

This solution is for Windows.

(See @Chris Knight's solution for Mac/Linux)

  1. Start Windows Powershell:

    Start -> type 'powershell' -> Press ENTER

  2. Run the following command: adb devices


PS C:\Users\CJBS>adb devices
List of devices attached
emulator-5656   host
emulator-5652   host
12b80FF443      device

In this case, 12b80FF443 is my physical device, and the emulator-* entries are garbage.

  1. Per @Brigham, "The way that Android detects emulators is by scanning ports starting at port 5555.". The port number is indicated after the emulator name (in this case 5656 and 5652). The port number to check is the emulator port number plus 1. So in this case:-

    5656 + 1 = 5657

    5652 + 1 = 5653

    So let's see which program is using these ports. In this case, the ports to check both start with "565". So I'll search for ports in use starting with 565. Execute: netstat -a -n -o | Select-String ":565"


PS C:\Users\CJBS> netstat -a -n -o |  Select-String ":565"

  TCP    127.0.0.1:5653         127.0.0.1:5653         ESTABLISHED     5944
  TCP    127.0.0.1:5657         127.0.0.1:5657         ESTABLISHED     5944
  1. The final field in this output is the PID (Process ID) - in this case it's PID 5944 for both of these two ports. So let's see what this process ID is. Execute: tasklist /v | Select-String 5944. Replace 5944 with the output of the previous command:

PS C:\Users\CJBS> tasklist /v | Select-String 5944

adb.exe                       5944 Console                    1      6,800 K Running         MyPCName\CJBS          0:06:03 ADB Power Notification Window

What a surprise. It's ADB. As noted by other answers, it could be other programs, too.

  1. Now, just kill this process ID. Execute kill 5944, replacing 5944 with the PID in the previous command.

PS C:\Users\CJBS> kill 5944
  1. To confirm that the spurious emulator is gone, re-run the following command: adb devices

PS C:\Users\CJBS>adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
12b80FF443      device

ADB re-starts (as it was previously killed), and it detects no more fake emulators.

Craw answered 19/11, 2015 at 17:5 Comment(3)
Thank you, in my case VSCode has opened a port 5555 and created a ghost 5554 emulator. Closed VSCode for the time of the operation.Gizmo
Thanks so much, just what I needed! And I got a thorough lesson in PowerShell commands too.Trite
This works great and was the only thing that worked for me after 2 hours of research! For windows: Step 3, just run netstat -a -n -o, copy the contents and paste it in notepad and search for that port your emulator port + 1. Then run "taskkill /PID #### /F" where #### is your port. Then restart ADB and you are good.Tymon
L
32

From the AVD Manager try the "Cold Boot Now" option in the drop-down. It worked for me!

Leatherback answered 1/2, 2018 at 10:6 Comment(2)
This is probably the first thing people should try before going in these over-complicated other solutions...Hizar
thanks! I was struggling for almost 2 hours.Heidyheifer
G
26

If you are on Linux or Mac, and assuming the offline device is 'emulator-5554', you can run the following:

netstat -tulpn|grep 5554

Which yields the following output:

tcp        0      0 127.0.0.1:5554          0.0.0.0:*               LISTEN      4848/emulator64-x86
tcp        0      0 127.0.0.1:5555          0.0.0.0:*               LISTEN      4848/emulator64-x86

This tells me that the process id 4848 (yours will likely be different) is still listening on port 5554. You can now kill that process with:

sudo kill -9 4848

and the ghost offline-device is no more!

On macOS Big Sur and later, use

sudo lsof -i -P | grep LISTEN | grep 5554

to find out the process.

Gogol answered 17/10, 2014 at 10:49 Comment(0)
L
19

I finally solved this problem, I had to go to the Developer options from the Settings in the Emulator, then scrolled down a little, turned on the USB debugging. Instantly my device was recognized online, and I no longer faced that issue. I tried restarting android studio and emulator, killing adb process, but those did not work.

Logotype answered 21/1, 2018 at 10:41 Comment(6)
you are a hero!Bucko
Hi @Shamsul can you please describe how to access the Developer Options from the Settings, in the Emulator? I presume you are referring to AVD Manager, in Android Studio. I have the same issue described in this thread and have tried all the things suggested except your suggestion. I do not see any Developer Options for the Emulator in the AVD Manager.Twombly
Hi Eddie, the usual procedure to turn on the developer option is the same for emulator and real devices. Find the build number in the software information, tap on it repeatedly, after maybe 7-10 taps, you will see that the developer option has been enabled.Logotype
I resolved the issue by toggling USB debugging in Developer options. I am not sure why this happened out of the blue, but this resolved the problem.Smokechaser
This is what finally worked. It's crazy we have to do this on an emulator.... which is meant to be used for debugging...Lichenin
I'm working with emulator :(Flagon
V
15

I also had the same issue. I've tried all solutions described here, but they didn't help me. Then I've removed all emulators in the Android Virtual Device Manager and created new ones. The problem was in the CPU/ABI system image configuration of the Android Virtual Device Manager. My Windows10 machine emulator with system image x86 is always offline, where the emulator with system image x86_64 is working fine as expected. Just be aware of this

Vc answered 6/10, 2017 at 7:50 Comment(5)
on my case, x86 system images windows 10, I just need to delete all emulator then recreate themBottali
Thank you so much, I've spent so much time trying to get this to work and this was my problemReflate
Same here, but on Windows 7.Hindenburg
Thank you man!! almost 2 days dealing with this. You are a heroFlagon
@RodrigoIbarra glad to help. I also struggled)Vc
S
11

I solved this by opening my commandprompt:

adb kill-server

adb devices

After starting up, ADB now detects the device/emulator.

Soule answered 7/11, 2013 at 9:2 Comment(0)
F
10

Enable USB Debugging into your emulator

  1. Settings > About Phone > Build number > Tap it 7 times to become developer;
  2. Settings > Developer Options > USB Debugging.

That's it enjoy

Finite answered 22/8, 2017 at 16:12 Comment(1)
Re-enabling USB debugging helped me (turning off and on)Burkitt
B
9

In my case, I found some process that makes adb not work well.
You can try to kill some strange process and run "adb devices" to test.

It worked for me:
kill the process name MONyog.exe

Brochure answered 6/1, 2013 at 10:24 Comment(0)
A
9

Just write

adb -e reboot

and be happy with adb))

Antho answered 23/3, 2015 at 22:41 Comment(3)
This tells ADB to reboot emulator. It cannot work if it's marked offline.Mizell
works if you previously execute rm -Rf ~/.android to clean offline devices. Best command and only one to solve my problem. No kill-server or start-server did the trick.Fredrika
I'm not sure about the -e flag, but this is clearly my favorite solution!Disturbing
J
6

open your emulator,

setting --> about emulated device --> click Build number repeatedly-->open developer options --> open USB debuggin

Jalbert answered 9/5, 2019 at 6:13 Comment(1)
The problem is the emulator is just having a black screen. You can only do this if you can access settings.Holmium
H
5

The "wipe user data" option finally solved my problem. just wipe user data every time you start the emulator. This always works for me! I use windows 8 x64 , eclipse

Heavierthanair answered 2/1, 2014 at 16:2 Comment(3)
tried all above but worked with clearing wipe user data alone.ThanksSukin
@SaiRam, you didn't try all above, because this hint was repeated in several answers. Also Cold Boot Now helps.Damalis
@SaiRam, sorry. :) Thanks.Damalis
B
4

From AVD manager list at the actions dropdown: Cold Boot Now

restarts it without all pain above.

Baugher answered 23/2, 2018 at 11:37 Comment(0)
C
3

Do you have bluestacks installed? If you do, the background processes that it runs creates the offline device "emulator-5554".

Go to the task manager and end all the processes with the description of "Bluestacks"

Carabiniere answered 31/10, 2013 at 18:41 Comment(0)
G
3

Try this ...

  1. Close emulator if it Running.

  2. Start Emulator again and wait for its online.

  3. enter Command in commandprompt and press ENTER key : adb tcpip 5555

(Make sure that only One emulator running at a time.)

  1. adb -s emulator-5555 emu kill

  2. Press Enter Key....

  3. Done.

  4. check devices by command "adb devices" in cmd.

Gen answered 10/3, 2014 at 5:32 Comment(1)
the issue is that it does not turn to be onlineBugs
C
3

In my case, I started in 'Cold Boot Now' and clicked on Message to allow the connection.

Carrew answered 3/2, 2019 at 11:10 Comment(0)
D
2

Did you try deleting and recreating your AVD? You can manually delete the AVD files by going to the directory they're stored in (in your user's /.android/avd subdirectory).

Dental answered 30/6, 2010 at 19:29 Comment(1)
Hi, thanks for the reply. I did try that actually. Still there. I'm tempted to just re-install everything.Shostakovich
D
2

Go to windows task manager and end process "adb.exe". There might be more than 1 instances of the same process, make sure to end all of them.

Dartboard answered 10/10, 2011 at 5:19 Comment(2)
How about "adb kill-server"?Soule
How about mac ?Fetch
R
2

on linux or mac the port thats blocked will emulator-id + 1 so 5555 so: sudo lsof -i :5555 will show you the pid of process that are taking the port (should be the second column) so to kill it: sudo lsof -i :5555 | awk '{print $2}' | xargs kill

then adb (fake) devices will no longer show on the list

Rigdon answered 1/11, 2016 at 15:18 Comment(0)
B
2

In my case, the emulator was working with Oreo and lower, but not with Pie, and everything I tried seemed to have no effect. What finally worked was updating the emulator to latest (version 28).

Brooklet answered 3/2, 2019 at 8:23 Comment(1)
me too... pretty annoyingFrumpish
R
1

I found that the emulation environment comes up as "offline" when the adb revision I am using was not recent. I properly updated my paths (and deleted the old adb version) and upon "adb kill-server", "adb devices", the emulation environment no longer came up as "offline".

I was immediately able to use "adb shell" after that point.

Reconcile answered 25/9, 2013 at 21:22 Comment(0)
B
1

If the emulator is already open or executing it will tell you is offline. You can double check on the Command Line (Ubuntu) and execute:

 adb devices

You must see your emulator offline, you have to close the running instance of the emulator (since the port will show as busy) and after that you can run your application. Hope this helps someone.

Benefaction answered 20/3, 2015 at 17:17 Comment(0)
M
1

I tried everything but only this one works for my case: Use SDK manager, and reinstall the system image. Android Studio, click Configure, SDK Manager, Launch Standalone SDK Manager, Check all "Google APIs Intel x86* System Image", "Intel x86 Atom*System Image" and install. Then re-start Android studio.

You might have to reconfigure and wipe the virtual device with AVD Manager, make sure you choose x86 version.

Monaxial answered 30/3, 2016 at 14:35 Comment(1)
For me , it was the x86_64 version that is working, the others did not workShatzer
P
1

Ensure that your enable ADB integration is marked; go to Tools>Android>Enable ADB integration .

if doesn't checked , check this option and close your virtual device and re-open it . this worked for me.. good luck!!

Pelasgian answered 2/4, 2017 at 23:45 Comment(0)
B
1

In MAC, you can use Activity Monitor utility, since, unlike Linux, we cannot use netstat -tulpn command in MAC. Search for the running instance of the emulator, typically qemu-system-i386. Kill that instance and you will see none of the ghost emulator running.

Simplest way to grab Activity monitor utility is to use spotlight search. just hit cmd-space and type in Activity Monitor.

Bobette answered 23/8, 2017 at 11:16 Comment(0)
H
1

I had the same issue with my virtual device. The problem is due to the Oreo image of the virtual devices that have the Play Store integrated. To solve this problem I installed a new device without the Play Store integrated and all it was fine.

Hope it helps, Bye

Herbal answered 26/3, 2019 at 14:38 Comment(1)
what a weird situation, but it fixed it for me too.Ammoniacal
D
1

See emulator-5554 unauthorized for adb devices. On API 29 emulator I run adb devices command and got emulator-5554 unauthorized message. Then I created a new avd device from Google APIs image (in my case Q, x86), not from Google Play.

Damalis answered 8/8, 2019 at 8:54 Comment(0)
W
1

Just to add, it could be that you disabled the developer options from the emulator or the debug mode.

In those cases the terminal will print adb: device offline when trying to perform operations.

Wingspan answered 12/10, 2022 at 1:52 Comment(0)
J
0

Simply delete and created gear avd again.It will work.

Jacquejacquelin answered 5/4, 2014 at 14:37 Comment(0)
D
0

In my case the cause was that I had resumed a VM with android-x86 inside. Rebooting the VM with Android-x86 and restarting the adb server fixed the problem.

Dissimilarity answered 11/10, 2014 at 17:26 Comment(0)
N
0

That is because of the fact that you have another virtual device installed on your machine. It might be Bluestacks as I also faced a similar problem. I uninstalled Bluestacks and then checked adb devices It was running fine then.

Neckline answered 3/12, 2014 at 5:43 Comment(0)
D
0

In my case, I have unchecked "GPU Host" and its worked :)

Dissimilitude answered 9/7, 2015 at 7:59 Comment(0)
E
0

Just Wipe user data from AVD manager and then enter adb kill-server and adb devices. Wiping data also saves lot of memory space in the System .

Elisavetpol answered 30/12, 2015 at 14:39 Comment(0)
N
0

I'll add another possible solution here, which is what worked in my case.

I found there was a process called SpiceWorksEventProcessor running, which was tying up port 5555, and apparently being read by adb as an emulator. Killing that process was what finally removed that stubborn emulator device for me.

I'm not sure what this thing is, but if you have it, it might be the cause of your offline emulator.

Cheers

Nonpayment answered 21/8, 2016 at 17:22 Comment(0)
C
0

All above answers didn't helped,and then I deleted and recreated emulator all worked fine

Cumber answered 24/4, 2017 at 15:31 Comment(0)
C
0

step 01: Delete current emulator from AVD manager step 02: Add new emulator. select device => select system image, in this step go to x86 images tab and select one which has the target with google APIs. step 03: Finish all steps. Your're good to go 🎉️

Clarita answered 29/3, 2020 at 5:43 Comment(0)
T
0

In my case the reason was the port forwarding in the NAT connection settings of VMware.

Tricostate answered 21/5, 2021 at 20:17 Comment(0)
D
0

In case you wipe data, your emulator still cannot connect to the internet. enter image description here

Please check your DNS network and add DNS 8.8.8.8 enter image description here

Disharmony answered 17/1, 2022 at 15:21 Comment(0)
D
0

I was using the command line to start the emulator, and there is an option there:

-delay-adb "delay adb communication till boot completes"

Unfortunately, it stayed offline even after boot completed. Removing the option solved the issue.

Db answered 29/1, 2022 at 20:41 Comment(0)
Z
0

For mac users

Go to terminal and type adb kill-server and then go to force quit the application and find any emulator is running and click on force quit.

Zip answered 1/2, 2022 at 11:29 Comment(0)
M
0

try using default or google_apis system image and not google_apis_playstore, as the playstore image requires authentication.

See here: https://mcmap.net/q/112943/-how-to-accept-debugging-dialog-for-android-emulator-via-command-line

Medor answered 3/6, 2022 at 23:10 Comment(0)
F
0

Deleting the AVD and re-installing again was the only thing that worked for me.

Focal answered 5/6, 2022 at 8:28 Comment(0)
D
0

In my case, it is the jdk version causes the issue. It should be openjdk-8-jdk for A-Studio Chipmunk (2021.2.1) to use, not the openjdk-11 comes with the system preinstalled. After running:

apt install -y openjdk-8-jdk

The problem is solved for Chipmunk!

I found this solution as a side effort to solve sdkmanager issue encountered. The link Fix sdkmanager java.lang.NoClassDefFoundError batchfile gives the optimal help.

Deration answered 14/6, 2022 at 22:52 Comment(0)
R
0

Removing the lock on the AVD device will help in running Wipe data, cold boot now, delete, etc actions will work, if they are not working before.

Run below to remove the lock. AVD name is the name you gave when creating it.

rm -vfr ~/.android/avd/[AVD name].avd/*.lock
Rybinsk answered 18/7, 2022 at 23:9 Comment(0)
W
0

This command worked for me and kill the emulator running in the background -

adb emu kill
Wendell answered 26/9, 2022 at 17:46 Comment(0)
C
-1

I just cleared all the open tap of terminal and i restarted my system then it started working. enter image description here

Cautery answered 31/1, 2023 at 6:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.