Search code examples
androidmacosjenkinsandroid-emulatorandroid-emulator-plugin

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


Hi I am working on a MAC book. When I start the android emulator through Jenkins 80% of the time the emulator fails to boot. Without Jenkins it works.

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

...

I am using android emulator plugin. The funny thing is when I am using the command line as jenkins user it works as well. Any Ideas?


Solution

  • Ok it seems like the issue has something to do with the jenkins android plugin. (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-emulator/ .

    However this didn't fix the Error message in the log. But it works.

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