AndroidViewClient - 如何在 Android 虚拟设备启动过程完成时收到通知?

AndroidViewClient - How to get notified when the Android Virtual Device start process is completed?

我使用 AndroidViewClient 是为了使用 MonkeyRunnerPython。我需要以编程方式启动 AVD,并在 AVD 启动过程完成时 收到通知 。我怎样才能赶上那个事件?执行只是没有到达 subprocess.run() 函数之后的行。

以下是我如何开始 AVD:

subprocess.run('emulator -avd Nexus_5_API_26 -wipe-data', shell=True)
// the execution just does not reach this line

您可以使用

检测到 AVD 已准备就绪
adb wait-for-device

此外,要在后台启动模拟器,您需要 Popen