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
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
Related
Jenkins can't start the emulator. Here is the console output of 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
If I type in
/usr/local/android-sdk/tools/emulator -snapshot-list -no-window -avd hudson_en-US_160_WXGA720_android-15_x86
or
/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
I get
PANIC: Could not open: hudson_en-US_160_WXGA720_android-15_x86
I run jenkins on ubuntu 12.04.
The error "SDL init failure, reason is: No available video device" would suggest that the emulator isn't running in a graphical environment.
However, your log shows that a VNC server is being started. But perhaps the VNC server hasn't quite finished starting by the time the emulator starts.
You can check whether this is the case by delaying the emulator start by a few seconds.
From the Android Emulator plugin documentation:
Although the Android Emulator plugin has been designed to ensure it always runs after an Xvnc server has been started, the Xvnc plugin does not wait for the Xvnc server to be fully up-and-running before handing control over to the Android Emulator plugin.
For this reason, you may want to delay emulator startup by a few seconds (e.g. three to five), giving the Xvnc server time to finish starting-up before attempting to launch an Android emulator into it. To do so, enter the desired number of seconds in the "Startup delay" field under "Advanced" options.
Alternatively, you can untick the "Show emulator window" option in your job configuration, which won't show the emulator, and will remove the need to run a VNC server.
Jenkins can't start the emulator. Here is the console output of 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
If I type in
/usr/local/android-sdk/tools/emulator -snapshot-list -no-window -avd hudson_en-US_160_WXGA720_android-15_x86
or
/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
I get
PANIC: Could not open: hudson_en-US_160_WXGA720_android-15_x86
I run jenkins on ubuntu 12.04.
The error "SDL init failure, reason is: No available video device" would suggest that the emulator isn't running in a graphical environment.
However, your log shows that a VNC server is being started. But perhaps the VNC server hasn't quite finished starting by the time the emulator starts.
You can check whether this is the case by delaying the emulator start by a few seconds.
From the Android Emulator plugin documentation:
Although the Android Emulator plugin has been designed to ensure it always runs after an Xvnc server has been started, the Xvnc plugin does not wait for the Xvnc server to be fully up-and-running before handing control over to the Android Emulator plugin.
For this reason, you may want to delay emulator startup by a few seconds (e.g. three to five), giving the Xvnc server time to finish starting-up before attempting to launch an Android emulator into it. To do so, enter the desired number of seconds in the "Startup delay" field under "Advanced" options.
Alternatively, you can untick the "Show emulator window" option in your job configuration, which won't show the emulator, and will remove the need to run a VNC server.
I have installed the Android Emulator plugin for Jenkins. I can build and test an Android-project. My Jenkins is running on an Ubuntu-server (only access with terminal). The project is pulled from Github. Now I want to use the Emulator. This is my configuration:
Android OS version: 4.4
Screen density: 160
Screen resolution: 480x800
Target ABI:armeabi-v7a
I also installed adb and did the following command:
/opt/android-sdk-linux/tools/android update sdk --no-ui
But it doesn't work:
> /usr/bin/git rev-list 3440b28279e2e95113ce1c9499d9d881e76f6810 # timeout=10
$ /opt/android-sdk-linux/tools/android list target
[android] Using Android SDK: /opt/android-sdk-linux
$ /opt/android-sdk-linux/platform-tools/adb start-server
* daemon not running. starting it now on port 7767 *
* daemon started successfully *
$ /opt/android-sdk-linux/platform-tools/adb start-server
[android] Starting Android emulator
$ /opt/android-sdk-linux/tools/emulator -ports 7765,7766 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-19_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window
Failed to Initialize backend EGL display
Could not initialize emulated framebufferemulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
emulator: warning: opening audio output failed
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:7766
connected to localhost:7766
[android] Waiting for emulator to finish booting...
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:7766 shell getprop init.svc.bootanim
error: device offline
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:7766
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:7766 shell getprop init.svc.bootanim
error: device offline
...
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:7766
[android] Interrupted while waiting for emulator to finish booting.
[android] Emulator was shut down before it finished booting
$ /opt/android-sdk-linux/platform-tools/adb disconnect localhost:7766
[android] Stopping Android emulator
$ /opt/android-sdk-linux/platform-tools/adb kill-server
Archiving artifacts
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, AndroidManifest.xml is 10 min old
Is there someone with an explanation for this issue? Thanks
I face the same issue, even when trying the commands manually.
But I could solve the issue when using ports like 5555,5556 according to that comment: JENKINS-27456
There is an associated pull request: PR on github
I will see if I have time to get and test a build with that patch and will let you know if it solves that problem.
Jenkins can't start the emulator. Here is the console output of 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
If I type in
/usr/local/android-sdk/tools/emulator -snapshot-list -no-window -avd hudson_en-US_160_WXGA720_android-15_x86
or
/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
I get
PANIC: Could not open: hudson_en-US_160_WXGA720_android-15_x86
I run jenkins on ubuntu 12.04.
The error "SDL init failure, reason is: No available video device" would suggest that the emulator isn't running in a graphical environment.
However, your log shows that a VNC server is being started. But perhaps the VNC server hasn't quite finished starting by the time the emulator starts.
You can check whether this is the case by delaying the emulator start by a few seconds.
From the Android Emulator plugin documentation:
Although the Android Emulator plugin has been designed to ensure it always runs after an Xvnc server has been started, the Xvnc plugin does not wait for the Xvnc server to be fully up-and-running before handing control over to the Android Emulator plugin.
For this reason, you may want to delay emulator startup by a few seconds (e.g. three to five), giving the Xvnc server time to finish starting-up before attempting to launch an Android emulator into it. To do so, enter the desired number of seconds in the "Startup delay" field under "Advanced" options.
Alternatively, you can untick the "Show emulator window" option in your job configuration, which won't show the emulator, and will remove the need to run a VNC server.
Config
OS: Ubuntu 12.04 64bits
CPU: Quad-Core AMD Opteron(tm) Processor 2352, 2.1GHz
RAM: 2GB
Headless Ubuntu, I use Xvfb, without Eclipse
android: v4.2.2 & webdriver v2.32.0
Question
As you can see in next steps, the emulator is initialized and the Webdriver is loaded and enabled.
However the Android Webdriver isn't responding to a browser connection at the URL:
http://myremoteserver:8080/wd/hub
So is there a way to debug the Webdriver (eg: monitor its activity from the emulator shell)?
Concerning stackoverflow I read questions tagged with [android] [android-emulator] [webdriver] [selenium] , unfortunately I get no answer.
I also checked on the Android Developer Google Group.
I tried to be as precise as possible but if you need more informations, don't hesitate to ask me. Tx!
Detailed steps
shell commands are preceded by $
shell STDOUT are preceded by >
launch a virtual X server on screen 99 :
$ Xvfb :99 -ac -screen 0 1024x768x8 2>/dev/null &
define $DISPLAY :
$ export DISPLAY=:99
download the adt-bundle and unzip the sdk/ dir in ~ and renaming it 'android_sdk'
all the next commands are issued from ~/android_sdk/tools
update the sdk:
$ ./android update sdk --no-ui
list targets :
$ ./android list targets
I identified that the appropriate target is the number 25:
> id: 25 or "android-17"
Name: Android 4.2.2
Type: Platform
API level: 17
Revision: 2
Skins: WVGA854, WQVGA400, WSVGA, WQVGA432, WXGA800-7in, HVGA, WXGA800, WVGA800 (default), QVGA, WXGA720
ABIs : armeabi-v7a, mips, x86
create an emulator :
$ ./android create avd -n my_android -t 25 -c 100M --abi armeabi-v7a
launch the emulator :
$ ./emulator -avd my_android -no-audio &
> Failed to create Context 0x3005
> emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
check if emulator daemon found by server :
$ ../platform-tools/adb devices
> * daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
emulator-5554 device
download the latest Webdriver unzip it in 'tools/'
install the webdriver onto the emulator :
$ ../platform-tools/adb -s emulator-5554 -e install -r android-server-2.32.0.apk
> Success
launch the Webdriver :
../platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity -e debug true
> Starting: Intent { act=android.intent.action.MAIN cmp=org.openqa.selenium.android.app/.MainActivity (has extras) }
check that the Webdriver package is properly enabled via the emulator shell:
$ ../platform-tools/adb -s emulator-5554 shell
(from the emulator shell): $ pm list packages -e
> package:org.openqa.selenium.android.app
forward requests :
$ ../platform-tools/adb -s emulator-5554 forward tcp:8080 tcp:8080