获取活动管理器的状态

编程入门 行业动态 更新时间:2024-10-22 15:26:57
本文介绍了获取活动管理器的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在写一个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.

更多推荐

获取活动管理器的状态

本文发布于:2023-11-27 08:29:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637289.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理器   状态

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!