“[android]模拟器似乎没有开始;放弃”

时间:2013-11-13 14:06:24

标签: android jenkins adb

Jenkins无法启动模拟器。这是jenkins的控制台输出:

First time build. Skipping changelog.
Starting xvnc
[MatchMaking] $ vncserver :65 -localhost -nolisten tcp

New 'veam:65 (jenkins)' desktop is veam:65

Starting applications specified in /var/lib/jenkins/.vnc/xstartup
Log file is /var/lib/jenkins/.vnc/veam:65.log

$ /usr/local/android-sdk/tools/android list target
[android] Using Android SDK: /usr/local/android-sdk
[android] Adding 256M SD card to AVD 'hudson_en-US_160_WXGA720_android-15_x86'...
$ /usr/local/android-sdk/platform-tools/adb start-server
$ /usr/local/android-sdk/tools/emulator -snapshot-list -no-window -avd hudson_en-US_160_WXGA720_android-15_x86
[android] Starting Android emulator and creating initial snapshot
[android] Erasing existing emulator data...
$ /usr/local/android-sdk/tools/emulator -no-boot-anim -ports 60491,34583 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WXGA720_android-15_x86 -no-snapshot-load -no-snapshot-save -wipe-data
SDL init failure, reason is: No available video device
* daemon not running. starting it now on port 39546 *
* daemon started successfully *
[android] Emulator did not appear to start; giving up
$ /usr/local/android-sdk/platform-tools/adb disconnect localhost:34583
[android] Stopping Android emulator
$ /usr/local/android-sdk/platform-tools/adb kill-server
Terminating xvnc.
$ vncserver -kill :65
Killing Xvnc4 process ID 16861
Finished: NOT_BUILT

如果我输入

/usr/local/android-sdk/tools/emulator -snapshot-list -no-window -avd hudson_en-US_160_WXGA720_android-15_x86

/usr/local/android-sdk/tools/emulator -no-boot-anim -ports 60491,34583 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WXGA720_android-15_x86 -no-snapshot-load -no-snapshot-save -wipe-data

我得到了

PANIC: Could not open: hudson_en-US_160_WXGA720_android-15_x86

我在ubuntu 12.04上运行jenkins。

1 个答案:

答案 0 :(得分:6)

错误“SDL init failure,原因是:没有可用的视频设备”表示模拟器未在图形环境中运行。

但是,您的日志显示正在启动VNC服务器 。但也许VNC服务器在仿真器启动时还没有完全启动。

您可以通过将模拟器启动延迟几秒来检查是否是这种情况。

来自the Android Emulator plugin documentation

  

虽然Android Emulator插件的设计是为了确保它始终在Xvnc服务器启动后运行,但Xvnc插件不会等待Xvnc服务器完全启动并运行,然后再将控制权交给Android Emulator插件。

     

出于这个原因,您可能希望将模拟器启动延迟几秒(例如三到五),从而使Xvnc服务器有时间在尝试启动Android模拟器之前完成启动。为此,请在“高级”选项下的“启动延迟”字段中输入所需的秒数。


或者,您可以取消作业配置中的“显示模拟器窗口”选项,该选项不会显示模拟器,并且无需运行VNC服务器。