在多个模拟器上运行android应用程序的雄心勃勃的尝试-无法停止模拟器 [英] Ambitious attempt at running android app on multiple emulators - can't stop emulators

查看:107
本文介绍了在多个模拟器上运行android应用程序的雄心勃勃的尝试-无法停止模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个想法,可以使用一个avd在我的笔记本电脑上测试我的android应用程序,但是要使用多个config.ini文件来更改avd本身的外观.

So I have an idea of testing my android app on my laptop using one avd but with multiple config.ini files to change the makeup of the avd itself.

我创建了多个avds,并将config.ini文件复制到一个单独的文件夹中.

I have created multiple avds, and copied the config.ini files into a separate folder.

我还写了一个bash脚本

I have also written a bash script to

  • 循环浏览我的config.ini文件
  • 一次将它们复制到avd文件夹(覆盖最后一个)
  • 尝试停止任何当前正在运行的模拟器 (这是我的大问题)
  • 启动模拟器
  • 对此进行测试(需要截图)
  • adb将屏幕截图提取到一个文件夹中
  • 从下一个ini文件重新开始
  • loop through my config.ini files
  • copy them one at a time to the avd folder (overwriting the last one)
  • attempt to stop any current running emulator (this is my big problem)
  • start the emulator
  • run my tests on it (which take screenshots)
  • adb pull the screenshots off into a folder
  • start again with the next ini file

因此,我大部分工作都在进行,但我一生都无法停止/启动/重新启动avd.

So I have most of this working, but I can't for the life of me stop/start/restart the avd.

我从各种SO问题中尝试了多种方法,包括但不限于

I've tried multiple things from various SO questions including, but not limited to

  • adb mu杀
  • telnet杀死
  • adb shell stop
  • pgrep仿真器-f(查找pid),然后杀死-9以将其停止

在没有锁定我的脚本或保留一些剩余文件的情况下,似乎没有正常正常运行的情况,这意味着我无法再次启动模拟器.

nothing seems to work properly, regularly without either locking my script, or leaving some remnant files meaning I can't start the emulator again.

这似乎应该很简单,并且是在多个设备仿真器上运行我的应用程序而不必一次运行它们的好方法,这是我的笔记本电脑永远无法处理的(它可能在一次运行3个)一次)

This seems like it should be so easy and a great way to run my app on multiple device emulators without having to have them all running at once, something which my laptop would never be able to handle (it could do maybe 3 at once)

推荐答案

在(linux)shell上执行此操作:

Do this on a (linux) shell:

adb shell su -c 'svc power shutdown' && echo "target has shut down"

或者也许您必须扎根",例如: adb root && adb shell 'svc power shutdown' && echo "target has shut down"

Or maybe you have to do it "rooted", like this: adb root && adb shell 'svc power shutdown' && echo "target has shut down"

它将关闭目标(在仿真内部正确显示系统关闭"窗口),然后也关闭仿真器窗口.没有过时的锁定文件.

It will shutdown the target (properly shows the "system powerdown" window inside emulation) and then also closes the emulator window. No stale lockfile left behind.

当然,在启动目标之后,您将必须等待,直到目标正确启动并接受此类adb shell命令为止.

Of course after launching your target you will have to wait for this until the target has booted properly and accepts such adb shell commands.

只需在模拟目标android API 19(kitkat)上进行测试-效果很好.

Just tested it on emulated target android API 19 (kitkat) - worked nicely.

我希望它能解决您的远程脚本化多个目标设置的想法.

I hope it solves your idea of remote scripting your setup of multiple targets.

这篇关于在多个模拟器上运行android应用程序的雄心勃勃的尝试-无法停止模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆