[英]Get status of activity manager
I'm writing a python script that makes calls to adb to perform JUnit tests. 我正在编写一个Python脚本,该脚本调用adb以执行JUnit测试。 I've used 'adb get-state' and 'adb wait-for-device' to wait for when the emulator is booted and ready to go, but for some reason, both of these kick off too early.
我已经使用了“ adb get-state”和“ adb wait-for-device”来等待仿真器启动并准备就绪,但是由于某些原因,这两者都为时过早。 After these functions return, I get this error when I start to run my tests:
这些函数返回后,当我开始运行测试时出现此错误:
android.util.AndroidException: Can't connect to activity manager; is the system running?
Is there a way I can get the status of the activity manager? 有什么方法可以获取活动经理的身份? If I could just poll that status that should be sufficient.
如果我可以轮询那个状态就足够了。
Thanks! 谢谢!
adb wait-for-device tells you if the adbd on the device is responsive. adb wait-for-device告诉您设备上的adbd是否响应。 However, that it a linux-level daemon on the device, well below the level of the android platform which is normally started after (except in the case where ADB has just been enabled from the settings menu).
但是,它是设备上的linux级别的守护程序,远低于通常在其后启动的android平台的级别(除非刚刚从设置菜单启用了ADB,否则除外)。
Particularly on emulators, starting up the java-level android runtime is a lengthy process, so there can be a period of seconds to minutes when adbd is responsive, but there is no ActivityManager to talk to. 特别是在模拟器上,启动Java级android运行时是一个漫长的过程,因此adbd响应时可能需要几秒钟到几分钟的时间,但是没有ActivityManager可以与之对话。
After adb wait-for-server, putting an attempt to do whatever you are trying to do (presumably run the 'am' command) in a loop with a one second delay and checking the output may be the simplest solution. 在adb wait-for-server之后,尝试以一秒钟的延迟延迟尝试执行您想做的任何事情(大概运行“ am”命令)并检查输出可能是最简单的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.