我无法从命令提示符正常停止模拟器。
我使用的是 Linux Ubuntu v10.04(64 位)和 Android v2.3(API 9 - Gingerbread)。
我使用其快照启动了模拟器。现在我关心的是优雅地关闭正在运行的模拟器实例。我尝试过使用 kill -9
(模拟器运行的进程 ID)来关闭模拟器,但下次它不会启动,因为它的快照已损坏。请帮助我避免强制关闭模拟器。
知道如何修复它吗?
I am unable to stop the emulator from command prompt gracefully.
I am using Linux Ubuntu v10.04 (64-bit) and Android v2.3 (API 9 - Gingerbread).
I started emulator using its snapshot. Now my concern is to shut down the running instance of Emulator gracefully. I have tried with kill -9
(process Id for emulator running) which shuts down the emulator but next time it does not start as its snapshot got corrupted. Please help me to avoid forceful shutdown of the an emulator.
Any idea how to fix it?
发布评论
评论(3)
请不要乱用
kill -9
,这是一个非常不好的习惯。正确的命令是
或者我最好说它是正确的命令,直到最近的一些
adb
更改。似乎有人忘记添加身份验证。在最新的(截至 2016 年 6 月)最新的
adb
版本中,当您尝试时
没有任何反应,这就是为什么
然后我们需要另一个解决方案。
如果上一个命令不起作用(正如一些 Windows 用户报告的那样),您可以尝试(在下一个命令中 5554 是模拟器使用的端口)。
将令牌文件 (
~/.emulator_console_auth_token
) 的内容复制到剪贴板,以便您可以在 telnet 会话期间粘贴它:然后,您只需在命令中输入
kill
提示,模拟器将退出。
但是等等,应该有更好的方法。事实上是有的!
这个要点使用expect 而不必每次都剪切并传递身份验证令牌。
希望您觉得它有用。
Please don't use
kill -9
indiscriminately, it's a very bad habit.The correct command is
Or I should better say it was the correct command until some recent
adb
changes. It seems somebody forgot to add the authentication to it.In the latest (as of June 2016) the latest
adb
version isand when you try
nothing happens, and this is why
Then we need another solution.
If the previous command does not work (as some users reported for Windows) you can try (in the next command 5554 is the port used by the emulator).
Copy the content of the token file (
~/.emulator_console_auth_token
) to the clipboard so you can paste it during your telnet session:Then, you can just enter
kill
at the command promptand the emulator will exit.
But wait, there should be a better way. And in fact there is!
This gist provides an automated solution using expect instead of having to cut and past the authentication token every time.
Hope you find it useful.
我在 ubuntu 中遇到问题,模拟器会不断打开新进程。我永远无法关闭模拟器并且它没有响应。
我使用了
htop
htop中的步骤:
I had issues in ubuntu where the emulator would continuously open new processes. I could never close the emulator and it was unresponsive.
I used
htop
Steps in htop:
在 Ubuntu 16-04 上,使用 ADB 版本 1.0.32,我在 Docker 容器中运行 Android 4.4 (API 19) 模拟器。控制台暴露的端口为 30004,ADB 暴露的端口为 30005。
我可以通过执行
adb connect 0.0.0.0:30005
连接到它。不过,要杀死模拟器,我必须使用
adb -s emulator-30004 emu Kill
,使用0.0.0.0:30005
给我错误:未检测到模拟器< /代码>。
On Ubuntu 16-04, using ADB version 1.0.32, I'm running the emulator for Android 4.4 (API 19) in a docker container. The exposed ports are 30004 for the console and 30005 for ADB.
I can connect to it by doing
adb connect 0.0.0.0:30005
.To kill the emulator though, I have to use
adb -s emulator-30004 emu kill
, using0.0.0.0:30005
gives meerror: no emulator detected
.