Android 模拟器-5554 离线
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3152681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android emulator-5554 offline
提问by hanesjw
I'm having a problem with emulator-5554, it keeps telling me it is offline.
我在使用 emulator-5554 时遇到问题,它一直告诉我它处于离线状态。
When I do a adb devices
from the command line it says
当我adb devices
从命令行执行 a 时,它说
emulator-5554 offline
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.
问题是当我尝试使用abd install <path>
命令提示符将 .apk 文件安装到模拟器时,它告诉我它处于脱机状态,如果我创建另一个设备并运行该设备,然后尝试安装 .apk 文件,它说我连接的设备太多。换句话说,我无法安装我的 .apk 文件。
How in the world can I get rid of that damn 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?
我到底怎么能摆脱那个该死的模拟器 - 5554?我听说如果你重新启动,它应该清除所有设备,但这似乎不起作用。就像我的计算机启动时它正在初始化一样。有没有人遇到过这个问题?
Thanks
谢谢
采纳答案by Kshitij Mittal
In such a case, you can do all of the following in order to be assured that your emulator starts working again :
在这种情况下,您可以执行以下所有操作,以确保您的模拟器重新开始工作:
- Go to cmd and type
adb kill-server
- Go to task manager and find
adb
in processes. If you find one, right click on it and click on end process tree. - 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.
- 转到cmd并键入
adb kill-server
- 转到任务管理器并
adb
在进程中查找。如果找到,请右键单击它并单击结束进程树。 - 在 Eclipse 中,转到Window>Android Virtual Device Manager,单击要启动的 AVD,单击开始并取消选中“从快照启动”,然后单击启动。
That's it! It will take a while and it should resolve your problem.
就是这样!这将需要一段时间,它应该可以解决您的问题。
回答by Xakiru
回答by Brigham
The way that Android detects emulators is by scanning ports starting at port 5555.
Android 检测模拟器的方式是从端口 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.
您在adb devices
列表中看到的数字(在您的情况下为 5554)将比 adb 发现打开的端口少 1。
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.
您可能有一个正在运行的进程正在侦听端口 5555。要摆脱“离线”设备,您需要找到该应用程序并将其关闭或重新配置它以侦听不同的端口。
回答by CJBS
This solution is for Windows.
此解决方案适用于 Windows。
(See @Chris Knight's solutionfor Mac/Linux)
(见@克里斯骑士的解决方案为苹果机/ Linux的)
Start Windows Powershell:
Start -> type 'powershell' -> Press ENTER
Run the following command: adb devices
启动 Windows Powershell:
开始 -> 输入 'powershell' -> 按 ENTER
运行以下命令: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.
在这种情况下,12b80FF443 是我的物理设备,并且 emulator-* 条目是垃圾。
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"
根据@Brigham,“Android 检测模拟器的方式是从端口 5555 开始扫描端口。”。端口号显示在模拟器名称之后(在本例中为 5656 和 5652)。要检查的端口号是模拟器端口号加 1。所以在这种情况下:-
5656 + 1 = 5657
5652 + 1 = 5653
那么让我们看看哪个程序正在使用这些端口。在这种情况下,要检查的端口都以“565”开头。因此,我将搜索以 565 开头的正在使用的端口。执行:
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
- 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:
- 此输出中的最后一个字段是 PID(进程 ID)——在本例中,这两个端口的 PID 都是 5944。那么让我们看看这个进程ID是什么。执行:
tasklist /v | Select-String 5944
。将 5944 替换为上一条命令的输出:
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.
真是个惊喜。是亚行。正如其他答案所指出的,它也可能是其他程序。
- Now, just kill this process ID. Execute
kill 5944
, replacing 5944 with the PID in the previous command.
- 现在,只需杀死此进程 ID。执行
kill 5944
,将 5944 替换为上一个命令中的 PID。
PS C:\Users\CJBS> kill 5944
- To confirm that the spurious emulator is gone, re-run the following command: adb devices
- 要确认虚假模拟器已消失,请重新运行以下命令: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.
ADB 重新启动(因为它之前被杀死了),并且它不再检测到假模拟器。
回答by Shamsul Arefin Sajib
I finally solved this problem, I had to go to the Developer optionsfrom the Settingsin 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 adbprocess, but those did not work.
我终于解决了这个问题,我不得不去开发人员选项从设置在仿真器,然后向下滚动了一下,打开了USB调试。我的设备立即被在线识别,我不再面临这个问题。我尝试重新启动 android studio 和 emulator,杀死adb进程,但这些都不起作用。
回答by Chris Knight
If you are on Linux or Mac, and assuming the offline device is 'emulator-5554', you can run the following:
如果您使用的是 Linux 或 Mac,并假设离线设备是“emulator-5554”,则可以运行以下命令:
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:
这告诉我进程 ID 4848(您的可能会有所不同)仍在侦听端口 5554。您现在可以使用以下命令终止该进程:
sudo kill -9 4848
and the ghost offline-device is no more!
幽灵离线设备不复存在!
回答by DagW
I solved this by opening my commandprompt:
我通过打开命令提示符解决了这个问题:
adb kill-server
adb 杀死服务器
adb devices
亚行设备
After starting up, ADB now detects the device/emulator.
启动后,ADB 现在会检测设备/模拟器。
回答by Ryan Ou
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.
就我而言,我发现了一些使 adb 无法正常工作的过程。
您可以尝试杀死一些奇怪的进程并运行“adb devices”进行测试。
It worked for me:
kill the process name MONyog.exe
它对我
有用:杀死进程名称 MONyog.exe
回答by Paulo Taylor
From the AVD Manager try the "Cold Boot Now" option in the drop-down. It worked for me!
在 AVD 管理器中尝试下拉菜单中的“Cold Boot Now”选项。它对我有用!
回答by Volodymyr
I also had the same issue. I've tried all described here solutions but they didn't help me. Then I've removed all emulators in the Android Virtual Device Managerand created new ones. The problem was in CPU/ABIsystem image configuration of the Android Virtual Device Manager. On my Windows10 machine emulator with system image x86
always is offline where emulator with system image x86_64
is working fine as expected. Just be aware of this
我也有同样的问题。我已经尝试了这里描述的所有解决方案,但它们没有帮助我。然后我删除了Android 虚拟设备管理器中的所有模拟器并创建了新的模拟器。问题出在Android Virtual Device Manager 的CPU/ABI系统映像配置中。在我的带有系统映像的 Windows10 机器模拟器上,带有系统映像的模拟器按预期正常工作时始终处于脱机状态。请注意这一点x86
x86_64