获取活动管理器的状态 [英] Get status of activity manager

查看:163
本文介绍了获取活动管理器的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个Python脚本,使呼叫亚行执行JUnit测试。我用亚行GET状态和亚洲开发银行等换设备等仿真器已启动,并准备去,但不知什么原因,这两个开球为时尚早。经过这些函数返回,我当我开始运行我的测试中得到这个错误:

I'm writing a python script that makes calls to adb to perform JUnit tests. 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. 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.

谢谢!

推荐答案

ADB等待换设备会告诉你,如果设备上的adbd响应。然而,它在设备上一个linux级守护进程,远低于其之后正常启动(除非在亚行刚刚启用从设置菜单的情况下)Android平台的水平。

adb wait-for-device tells you if the adbd on the device is responsive. 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).

特别是在仿真器,启动了Java级Android运行时是一个漫长的过程,所以不可能有一段数秒到数分钟时adbd响应,但没有ActivityManager交谈。

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.

在ADB等待换服务器,将尝试做任何你正在尝试做的(presumably运行'我'命令)在一秒钟后一个循环,并检查输出可能是最简单解决方案。

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.

这篇关于获取活动管理器的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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