Android Emulator Plugin Failed to Initialize backe

2019-07-13 10:39发布

问题:

I set up a Jenkins Job on Cloudbees and I can successfully checkout and compile my Android project there. Now I would like to run some JUnit tests in the android emulator and added the Android emulator plugin. I set the “Show Emulator Window“ option to false but after startup of the emulator I always get the error message: “Emulator did not appear to start; giving up”. Has anyone experience with Android builds on Cloudbees?

Build log:


    $ /opt/android/android-sdk-linux/tools/android list target
    [android] Using Android SDK: /opt/android/android-sdk-linux
    [android] Creating Android AVD: /home/jenkins/.android/avd/hudson_en-US_160_WVGA_android-17_armeabi-v7a.avd
    [android] /opt/android/android-sdk-linux/tools/android create avd -f -a -c 64M -s WVGA800 -n hudson_en-US_160_WVGA_android-17_armeabi-v7a -t android-17 --abi armeabi-v7a
    $ /opt/android/android-sdk-linux/platform-tools/adb start-server
    [android] Starting Android emulator
    $ /opt/android/android-sdk-linux/tools/emulator -no-boot-anim -ports 59102,56142 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-17_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window
    Failed to Initialize backend EGL display
    * daemon not running. starting it now on port 52538 *
    * daemon started successfully *
    [android] Emulator did not appear to start; giving up
    $ /opt/android/android-sdk-linux/platform-tools/adb disconnect localhost:56142
    [android] Stopping Android emulator
    $ /opt/android/android-sdk-linux/platform-tools/adb kill-server

回答1:

Compare your job configuration with https://partnerdemo.ci.cloudbees.com/job/Android-dev/job/stockfish-android-cloud/, paying particular attention to the following settings:

Inject env var: LD_LIBRARY_PATH=/opt/android/android-sdk-linux/tool/lib
Target ABI: armeabi-v7a
Advanced -> Emulator Options: -no-audio -gpu off
Advanced -> Emulator Executable: emulator64-arm