Android 从命令行停止模拟器

标签 android android-emulator

此问题与 How to shut down Android emulator via command line 相同.

但是,在尝试了第一个答案中的建议解决方案后,adb emu kill 对我来说并没有成功。

我正在为 android 应用程序自动进行单元测试。我的 bash 脚本在 headless 机器上运行。它使用 android create avd 创建一个 android 设备,并使用 -no-window 属性执行 emulator。然后它编译测试项目,使用 adb 连接到模拟器,安装项目并执行我的测试。这一切都很好。

现在我需要终止模拟器进程,就像引用的帖子一样,我只能使用 kill -9 来执行此操作。

Google 教程 Managing AVDs from the Command Line只提到如何在 GUI 环境中停止模拟器。

感谢任何帮助。

最佳答案

adb kill-server 可能对你有帮助吗?

adb -s emulator-5544 emu kill,其中emulator-5544 - 模拟器名称。

对于 Linux 用户,它将是

adb 设备 | grep 模拟器 |切-f1 |而读线;执行 adb -s $line emu kill;完成

关于Android 从命令行停止模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20155376/

相关文章:

android - 保护应用程序中的对称 key

android - 如何在 Android Emulator 中编译和运行 Google Contacts App

react-native - 在 BIOS 设置中启用英特尔硬件虚拟化有什么缺点吗?

scripting - adb emu Kill - 等待模拟器被完全杀死

android - 我的 apk 文件在模拟器中的位置

android - 如何在 Android 的 WebView 中加载 url 以正确查看?

android - 在 opengl es 20 中将两个着色器属性合并到一个着色器中?

android - 对话框未设置布局参数

android - 使用gson解析json文件

android - 我可以直接在 ContentProvider 的 open ParcelFileDescriptor openFile() 中传递我的 InputStream 吗?