从Jenkins启动AVD
我想从Jenkins启动一个安卓模拟器。为此,我写了一个批处理文件,内容如下:
cd E:\android-sdk\tools
emulator.exe -avd "AVD" -wipe-data
我通过Jenkins执行这个批处理文件,但它没有启动模拟器。
我还尝试用Python来启动,代码如下:
bash = "E:\\android-sdk\\tools\\emulator"
print "executing: " + bash
f_handle = open('test_output_launch.txt','w+')
process = subprocess.Popen([bash, '-avd', 'AVD'])
但是这样会出现一个错误,提示 'PANIC: Could not open: AVD'
。而当我不通过Jenkins直接运行这个批处理文件时,一切都正常。我需要启动AVD,安装apk,并通过Jenkins运行一些自动化测试。请帮帮我!!
3 个回答
0
你可以先在命令行里试运行你的脚本。
0
我觉得这应该是权限问题。试着以管理员身份运行Jenkins客户端。
对于Python,把你的子进程调用改成
process = subprocess.Popen(['emulator.exe', '-avd', 'AVD'], cwd=bash)
0
终于通过Jenkins的“Android模拟器插件”搞定了。