Android 仅通过 Jenkins 启动时,模拟器有 80% 的时间无法启动

Android emulator failed to boot 80% of the time when started via Jenkins only

您好,我正在写 MAC 一本书。当我通过 Jenkins 启动 android 模拟器时,有 80% 的时间模拟器无法启动。没有 Jenkins 也可以。

Building in workspace /Users/Shared/Jenkins/Home/workspace/Stress Test
$ /Users/Shared/Jenkins/Home/tools/android-sdk/tools/android list target
[android] Using Android SDK: /Users/Shared/Jenkins/Home/tools/android-sdk
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
* daemon not running. starting it now on port 5653 *
* daemon started successfully *
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server
[android] Starting Android emulator
$ /Users/Shared/Jenkins/Home/tools/android-sdk/tools/emulator -no-boot-anim -ports 5651,5652 -avd test_device -no-snapshot-load -no-snapshot-save -no-window
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
Failed to create Context 0x3005
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
HAX is working and emulator runs in fast virt mode
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb connect emulator-5651
[android] Waiting for emulator to finish booting...
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb -s emulator-5651 shell getprop dev.bootcomplete
error: device offline

...

我正在使用 android 模拟器插件。 有趣的是,当我以 jenkins 用户身份使用命令行时,它也能正常工作。有什么想法吗?

好的,这个问题似乎与 jenkins android 插件有关。 (https://issues.jenkins-ci.org/browse/JENKINS-11952) . I updated Jenkins Android Plugin to 2.13-SNAPSHOT and it works now. You can find the update here: https://jenkins.ci.cloudbees.com/job/plugins/job/android-emulator-plugin/lastStableBuild/org.jenkins-ci.plugins$android-模拟器/.

然而,这并没有修复日志中的错误消息。但它有效。

Failed to create Context 0x3005
emulator: WARNING: Could not initialize OpenglES emulation, using software      renderer.