如何使用 Monkeyrunner 重新启动 Android 模拟器?
这个脚本有什么问题?
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
#Reboot
device.reboot('None')
我还尝试更改 bootloadType。安装了我尝试使用的最后一行 device.reboot('bootloader') 和 device.reboot('recovery'),但它也不起作用。
What is wrong with this script?
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
#Reboot
device.reboot('None')
I also tried changing the bootloadType. Insted of the last line I tried with, device.reboot('bootloader') and device.reboot('recovery'), but it didn't work either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android 开发者的帖子此处内容如下:
对于模拟器来说,理想情况下你应该能够使用:
...但是出现了一个错误 此处针对模拟器的启动/停止>= 2.2。
就我个人而言,我使用一个令人讨厌的小 shell 脚本来终止所有模拟器实例,然后再次启动模拟器:
可以通过传入要终止的特定模拟器的序列号来完善此脚本(可以使用“adb get 获取序列号”) -serialno”)
我很想看看其他人的想法/他们自动重启模拟器的方式。
Post by an Android dev here says the following:
For emulator ideally you should be able to use:
... but there is a bug raised here against start/stop for emulators >= 2.2.
Personally, I use a nasty little shell script to kill off all emulator instances and then start the emulator again:
This script can be refined by passing in a serial number of a particular emulator to kill off (can get the serial number using "adb get-serialno")
I'd be intereted in seeing what others think/ways they are automating restart of emulator.