简体   繁体   English

获取活动管理器的状态

[英]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.

相关问题 仅按活动对象获取视图中活动的状态 - get status of activity in view just by activity object Android:使用警报管理器定期获取电池状态 - Android: Get Battery Status at regular intervals using alarm manager 有什么方法可以在Android上获取“下载管理器”状态作为服务? - is there any method to get “Download manager” status as service on android? Android Activity Manager REAL_GET_TASKS错误 - Android Activity Manager REAL_GET_TASKS Error 重新启动的活动无法获得它在重新启动前启动的服务的状态 - Restarted activity can not get status of service it started before restart 如何从非活动类获取AsyncTask完成状态 - How to get AsyncTask Completed Status From Non Activity Class 重新加载应用程序后,活动中的复选框处于相同状态 - Get same status of checkbox in activity after reload of application 如何在Interceptor Android中获取401状态代码的同时更改活动 - How to change activity while get 401 status code in Interceptor Android 我们是否可以选择从活动管理器获取活动时间信息 - Do we have option to get activity time information from Activity manager 如何获得另一个活动的开关的状态? - How do I get the status of another Activity's Switch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM