检测 Android 模拟器何时完全启动 [英] Detect when Android emulator is fully booted

查看:28
本文介绍了检测 Android 模拟器何时完全启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个脚本来启动模拟器,并在系统完全启动后,我想安装一个 .apk.

I want to create a script where I start an emulator and after the system is fully booted, I want to install an .apk.

我如何知道模拟器何时完全启动以便我可以运行安装命令?这里 http://developer.android.com/guide/developing/tools/adb.html 据说 adb wait-for-device install .apk 不正确.

How can I know when the emulator is fully booted so I can run the install command? Here http://developer.android.com/guide/developing/tools/adb.html it is said that adb wait-for-device install <app>.apk is not correct.

那么我怎样才能做到这一点?是否可以?在确定模拟器已启动之前,我是否只能休眠几分钟?

So how can I achieve this? Is it possible? Is my only option to sleep for a few minutes until I can be sure that the emulator is started?

推荐答案

adb shell getprop init.svc.bootanim

这将告诉您启动动画是否正在运行.这是我们在无头构建服务器上使用的用于检查模拟器是否已启动的内容.来自 dac2009 的 sys.boot_completed 是我找到那个标志的原因.我们使用 init.svc.bootanim 代替,因为 boot_completed 有触发过早的趋势.

adb shell getprop init.svc.bootanim

This will tell you whether or not the boot animation is running. It's what we use on our headless build server to check if the emulator is up. The sys.boot_completed from dac2009 is what lead me to find that flag. We use init.svc.bootanim instead because boot_completed has a tendency of triggering too early.

这篇关于检测 Android 模拟器何时完全启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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