I am trying to run the emulator on the Jenkins server.
But I keep getting this error that Jenkins is unable to start the emulator becoz of the error below until it times out:
[android] Waiting 10 seconds before starting emulator...
$ /opt/android-sdk-linux/platform-tools/adb start-server
* daemon not running. starting it now on port 9666 *
* daemon started successfully *
$ /opt/android-sdk-linux/platform-tools/adb start-server
[android] Starting Android emulator
$ /opt/android-sdk-linux/tools/emulator64-arm -ports 9664,9665 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_320_HVGA_android-19_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window -no-audio -gpu off
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 51200 (4k) blocks long. Nothing to do!
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
unable to connect to localhost:9665: Connection refused
[android] Waiting for emulator to finish booting...
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb disconnect localhost:9665
error: no such device 'localhost:9665'
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb disconnect localhost:9665
error: no such device 'localhost:9665'
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:9665
$ /opt/android-sdk-linux/platform-tools/adb -s localhost:9665 shell getprop init.svc.bootanim
error: device 'localhost:9665' not found
What should I do to get over this darn issue?
I had the same issue and it turned out that adb was crashing. In my case the cause for the crash was a permission error. Try deleting the file /tmp/adb.log before running the job. Please see this thread for more information: Is it possible to fake a specific path for a process?
You could also add the -verbose option to the emulator to see more output that might help.
I'm trying to install an .apk to AVD but the process just hangs with message - waiting for device -.
Here's how I'm starting the emulator itself and connecting to it:
$ /opt/android-sdk-linux/tools/emulator-arm -no-boot-anim -ports 5851,5852 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-22_armeabi-v7a_myapp -no-snapshot-load -no-snapshot-save -no-window -force-32bit -noaudio -gpu off
Failed to Initialize backend EGL display
$ /opt/android-sdk-linux/platform-tools/adb connect emulator-5851
[android] Waiting for emulator to finish booting...
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell getprop init.svc.bootanim
error: device offline
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:5851
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell getprop init.svc.bootanim
error: device offline
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:5851
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell getprop init.svc.bootanim
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 logcat -v time
[android] Attempting to unlock emulator screen
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell input keyevent 82
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell input keyevent 4
[android] Emulator is ready for use (took 47 seconds)
/opt/android-sdk-linux/platform-tools/adb connect emulator-5851
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5584 install -r myapp-debug-unaligned.apk
error: device not found
- waiting for device -
When I'm trying to run AVD for older android version, it works fine.
I have Jenkins 1.568 installed on a Macbook Air running Ubuntu 14.04. I have the android emulator plugin installed, and the configuration I have set up runs the emulator in -no-window mode before starting each build.
About half of the builds are fine, but the other half, I get the following on the console:
[android] Starting Android emulator
$ /usr/local/src/android/android-sdk-linux/tools/emulator -no-boot-anim -ports 5782,5783 -avd Caesar -no-snapshot-load -no-snapshot-save -no-window -no-audio -no-skin -no-window
* daemon not running. starting it now on port 5784 *
* daemon started successfully *
Failed to Initialize backend EGL display
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
[android] Waiting for emulator to finish booting...
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
[android] Timed-out after waiting 360 seconds for emulator
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
[android] Stopping Android emulator
Clearly, the emulator is failing about 50% of the time. I'm not sure why, though, or how to fix it. Any suggestions would be welcome as to how I can get this running and not have to restart failed builds using naginator.
Try to update Java. I had android emulator problems in the past and a Java update fixed them.
Timeout problems.
DdmPreferences.setTimeOut is the global adb read/write packet timeout setting.
In 'at com.android.ddmlib.SyncService.doPushFile(SyncService.java:671)', DdmPreferences.getTimeOut() is called and used to set timeout.
In build.gradle:
android{
...
adbOptions {
timeOutInMs 10 * 60 * 1000 // 10 minutes
}
}
For Eclipse (Preferences -> Android -> DDMS).
Also, this is an environment variable that you set outside of build.gradle. On Ubuntu for instance:
$ export ADB_INSTALL_TIMEOUT=5
$ ./gradlew installDebug
Between runs:
sudo adb kill-server
and
sudo adb start-server
Here is a checklist to help:
1) You need the --all flag for both android list and android update sdk, otherwise some packages will not be installed: ex for SDK 24
1a)$ANDROID_HOME/tools/android list sdk --all
1b)
(for i in {1..100}; do echo y; sleep 1; done) |
$ANDROID_HOME/tools/android update sdk --no-ui --all --filter
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,79,80,81,82,82,84,85,101,102,103,112,113,117,118,119,120,121,122,123,124
if you get the dreaded /home/jenkins/android-sdk-linux/platform-tools/adb -s emulator-XXXX shell getprop dev.bootcomplete error: device offline error, you are likely missing a package in step 1b
2)Ignore the dreaded Failed to Initialize backend EGL display error, it is a red herring
3)Be sure to use the Advanced Emulator options:
Emulator Options: -no-audio -gpu off
Emulator executable: emulator64-arm
Startup delay: 10 -- this *may* help
4)a pre-build script ${ANDROID_HOME}/platform-tools/adb kill-server can't hurt
check out Jenkins site https://issues.jenkins-ci.org/browse/JENKINS-27456
https://issues.jenkins-ci.org/browse/JENKINS-11952
you can also check this one https://code.google.com/p/android/issues/detail?id=209955 and http://www.yzjingying.net/4855150152.htm
Good luck!
I just found solution Android Emulator Plugin Failed to Initialize backend EGL display
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
I hope its helps you.
I am using Android emulator plugin with jenkins. Along with the android application, I also have a java project for uiautomator which is the part of build modules in main pom.
The maven goal is : mvn install
The uiautomator test is failing at the point where it is trying to assert the presence of application launch icon from "Apps" screen.
Do I have to install the application apk or does the plugin does it automatically as described in the plugin documentation(My plugin version is 2.10 and jennkins version is 1.531)
How do i know that the application is installed in the emulator.
The emulator is started without any problem.
The following is the part of the jenkins log:
[android] Starting Android emulator $ /var/lib/jenkins/tools/android-sdk/tools/emulator -no-boot-anim -ports 35965,56985 -prop persist.sys.language=en -prop persist.sys.country=US
-avd hudson_en-US_120_800x1280_android-18_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window
* daemon not running. starting it now on port 42120 *
* daemon started successfully *
Failed to Initialize backend EGL display
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985 [android] Waiting for emulator to finish booting... $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete error: device offline $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete error: device offline $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete error: device offline $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:56985 $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:56985 $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell getprop dev.bootcomplete $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 logcat -v time
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985 [android] Attempting to unlock emulator screen $ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell input keyevent 82
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:56985 shell input keyevent 4
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:56985 [android] Emulator is ready for use (took 97 seconds)
Do I have to install the application apk or does the plugin does it automatically as described in the plugin documentation
The documentation does not say that your APK will be automatically installed.
But the plugin does provide a build step which will do this for you, if you provide the path to an APK file:
Under the "Build" section of your job configuration, select "Add build step" and choose "Install Android package".
In the "APK file" field that appears, enter the filename of the APK you wish to install. When a build runs, the APK will be automatically installed after the emulator has started up.
I use Jenkins to build one of my projects. The Android Emulator Plugin automatically starts an emulator with the following configuration:
Configuration of the Emulator Plugin:
.
Every time the job is running I get the following output:
Erasing existing emulator data... $
/ci/home/tools/android-sdk//tools/emulator -no-boot-anim -ports
64470,64471 -prop persist.sys.language=de -prop persist.sys.country=DE
-avd hudson_de-DE_240_480x720_Google_Inc._Google_APIs_8 -no-snapshot-load -no-snapshot-save -wipe-data
.
.
shell input keyevent 4 [android] Giving the system some time to settle
before creating initial snapshot... $
.
.
localhost:64471 shell log -p v -t Jenkins "Creating snapshot..."
[android] Creating snapshot... $
Full log below.
It seems that the plugin is creating a new emulator every time and is not using snapshots.
This takes something between 2 and 4 minutes depending on the emulator configuration.
The plugin creates .avd and .ini files in the .android/avd directory inside the job folder. The avds are not deleted after the run process.
If I disable the use snapshots config the emulator needs less then a minute to start.
Is this an issue with the emulator plugin or are snapshots not possible because of my configuration?
I hope that using snapshots will speed up my building process a lot.
Full log:
$ /ci/home/tools/android-sdk//tools/android list target [android]
Using Android SDK: /ci/home/tools/android-sdk/ [android] Adding 200M
SD card to AVD 'hudson_de-DE_240_480x720_Google_Inc._Google_APIs_8'...
[android] Setting hardware properties: hw.ramSize: 512
$ /ci/home/tools/android-sdk//platform-tools/adb start-server
$ /ci/home/tools/android-sdk//tools/emulator -snapshot-list -no-window -avd hudson_de-DE_240_480x720_Google_Inc._Google_APIs_8
[android] Starting Android emulator and creating initial snapshot
[android] Erasing existing emulator data...
$ /ci/home/tools/android-sdk//tools/emulator -no-boot-anim -ports 64470,64471 -prop persist.sys.language=de -prop persist.sys.country=DE -avd hudson_de-DE_240_480x720_Google_Inc._Google_APIs_8 -no-snapshot-load -no-snapshot-save -wipe-data
* daemon not running. starting it now on port 64472 *
* daemon started successfully *
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
[android] Waiting for emulator to finish booting...
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471
shell getprop dev.bootcomplete error: device offline
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell getprop dev.bootcomplete
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell getprop dev.bootcomplete
$ /ci/home/tools/android-sdk//platform-tools/adb disconnect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell getprop dev.bootcomplete
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell getprop dev.bootcomplete
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell getprop dev.bootcomplete
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 logcat -v time
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
[android] Attempting to unlock emulator screen
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell input keyevent 82
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell input keyevent 4
[android] Giving the system some time to settle before creating initial snapshot...
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 logcat -c
$ /ci/home/tools/android-sdk//platform-tools/adb -s localhost:64471 shell log -p v -t Jenkins "Creating snapshot..."
[android] Creating snapshot...
$ /ci/home/tools/android-sdk//platform-tools/adb connect localhost:64471
[android] Emulator is ready for use (took 158 seconds)
Buildfile for an example job:
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name></name>
<refspec></refspec>
<url>git#project...</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>false</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>false</wipeOutWorkspace>
<pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<useShallowClone>false</useShallowClone>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir></relativeTargetDir>
<reference></reference>
<excludedRegions></excludedRegions>
<excludedUsers></excludedUsers>
<gitConfigName></gitConfigName>
<gitConfigEmail></gitConfigEmail>
<skipTag>false</skipTag>
<includedRegions></includedRegions>
<scmName></scmName>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>true</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>true</blockBuildWhenUpstreamBuilding>
<triggers class="vector">
<hudson.triggers.SCMTrigger>
<spec>*/5 * * * *</spec>
</hudson.triggers.SCMTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Ant>
<targets>clean debug install</targets>
<antName>(Default)</antName>
</hudson.tasks.Ant>
<hudson.tasks.Ant>
<targets></targets>
<antName>(Default)</antName>
<buildFile>checkstyle-ant.xml</buildFile>
</hudson.tasks.Ant>
<hudson.tasks.Shell>
<command>os_opts="-Djava.awt.headless=true" lint --xml lint-results.xml .</command>
</hudson.tasks.Shell>
<hudson.plugins.android__emulator.monkey.MonkeyBuilder>
<packageId>de....</packageId>
<eventCount>1000</eventCount>
<throttleMs>10</throttleMs>
<seed>timestamp</seed>
</hudson.plugins.android__emulator.monkey.MonkeyBuilder>
<hudson.tasks.Shell>
... distribution script
</hudson.tasks.Shell>
</builders>
<publishers>
<org.jenkinsci.plugins.android__lint.LintPublisher>
<healthy></healthy>
<thresholdLimit>low</thresholdLimit>
<pluginName>[android-lint] </pluginName>
<defaultEncoding></defaultEncoding>
<canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll></unstableTotalAll>
<unstableTotalHigh></unstableTotalHigh>
<unstableTotalNormal></unstableTotalNormal>
<unstableTotalLow></unstableTotalLow>
<unstableNewAll></unstableNewAll>
<unstableNewHigh></unstableNewHigh>
<unstableNewNormal></unstableNewNormal>
<unstableNewLow></unstableNewLow>
<failedTotalAll></failedTotalAll>
<failedTotalHigh></failedTotalHigh>
<failedTotalNormal></failedTotalNormal>
<failedTotalLow></failedTotalLow>
<failedNewAll></failedNewAll>
<failedNewHigh></failedNewHigh>
<failedNewNormal></failedNewNormal>
<failedNewLow></failedNewLow>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>false</dontComputeNew>
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
<pattern></pattern>
</org.jenkinsci.plugins.android__lint.LintPublisher>
<hudson.plugins.checkstyle.CheckStylePublisher>
<healthy></healthy>
<unHealthy></unHealthy>
<thresholdLimit>low</thresholdLimit>
<pluginName>[CHECKSTYLE] </pluginName>
<defaultEncoding></defaultEncoding>
<canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll></unstableTotalAll>
<unstableTotalHigh></unstableTotalHigh>
<unstableTotalNormal></unstableTotalNormal>
<unstableTotalLow></unstableTotalLow>
<failedTotalAll></failedTotalAll>
<failedTotalHigh></failedTotalHigh>
<failedTotalNormal></failedTotalNormal>
<failedTotalLow></failedTotalLow>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
<pattern></pattern>
</hudson.plugins.checkstyle.CheckStylePublisher>
<hudson.plugins.warnings.WarningsPublisher>
<healthy></healthy>
<unHealthy></unHealthy>
<thresholdLimit>low</thresholdLimit>
<pluginName>[WARNINGS] </pluginName>
<defaultEncoding></defaultEncoding>
<canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll></unstableTotalAll>
<unstableTotalHigh></unstableTotalHigh>
<unstableTotalNormal></unstableTotalNormal>
<unstableTotalLow></unstableTotalLow>
<failedTotalAll></failedTotalAll>
<failedTotalHigh></failedTotalHigh>
<failedTotalNormal></failedTotalNormal>
<failedTotalLow></failedTotalLow>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<doNotResolveRelativePaths>true</doNotResolveRelativePaths>
<parserConfigurations/>
<consoleParsers>
<hudson.plugins.warnings.ConsoleParser>
<parserName>Java Compiler (Eclipse)</parserName>
</hudson.plugins.warnings.ConsoleParser>
</consoleParsers>
</hudson.plugins.warnings.WarningsPublisher>
<hudson.plugins.analysis.collector.AnalysisPublisher>
<healthy></healthy>
<unHealthy></unHealthy>
<thresholdLimit>low</thresholdLimit>
<pluginName>[ANALYSIS-COLLECTOR] </pluginName>
<defaultEncoding></defaultEncoding>
<canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll></unstableTotalAll>
<unstableTotalHigh></unstableTotalHigh>
<unstableTotalNormal></unstableTotalNormal>
<unstableTotalLow></unstableTotalLow>
<failedTotalAll></failedTotalAll>
<failedTotalHigh></failedTotalHigh>
<failedTotalNormal></failedTotalNormal>
<failedTotalLow></failedTotalLow>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<doNotResolveRelativePaths>true</doNotResolveRelativePaths>
<isCheckStyleDeactivated>false</isCheckStyleDeactivated>
<isDryDeactivated>true</isDryDeactivated>
<isFindBugsDeactivated>true</isFindBugsDeactivated>
<isPmdDeactivated>true</isPmdDeactivated>
<isOpenTasksDeactivated>true</isOpenTasksDeactivated>
<isWarningsDeactivated>false</isWarningsDeactivated>
</hudson.plugins.analysis.collector.AnalysisPublisher>
<hudson.plugins.android__emulator.monkey.MonkeyRecorder>
<failureOutcome>FAILURE</failureOutcome>
</hudson.plugins.android__emulator.monkey.MonkeyRecorder>
<hudson.plugins.cigame.GamePublisher/>
<hudson.tasks.Mailer>
<recipients></recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>true</sendToIndividuals>
</hudson.tasks.Mailer>
</publishers>
<buildWrappers>
<hudson.plugins.locksandlatches.LockWrapper>
<locks>
<hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
<name>AndroidEmulator</name>
</hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
</locks>
</hudson.plugins.locksandlatches.LockWrapper>
<hudson.plugins.android__emulator.AndroidEmulator>
<osVersion>Google Inc.:Google APIs:8</osVersion>
<screenDensity>240</screenDensity>
<screenResolution>480x720</screenResolution>
<deviceLocale>de_DE</deviceLocale>
<sdCardSize>200M</sdCardSize>
<hardwareProperties>
<hudson.plugins.android__emulator.AndroidEmulator_-HardwareProperty>
<key>hw.ramSize</key>
<value>512</value>
</hudson.plugins.android__emulator.AndroidEmulator_-HardwareProperty>
</hardwareProperties>
<wipeData>false</wipeData>
<showWindow>true</showWindow>
<useSnapshots>true</useSnapshots>
<deleteAfterBuild>false</deleteAfterBuild>
<startupDelay>0</startupDelay>
<commandLineOptions></commandLineOptions>
</hudson.plugins.android__emulator.AndroidEmulator>
</buildWrappers>
</project>
A bug was introduced in SDK Tools r20, whereby trying to list the available snapshots (via the emulator -snapshot-list command) would result in a crash.
Since the command crashes without listing the available snapshots, the Android Emulator Plugin believes that there are no existing snapshots, which causes a new snapshot to be created in every build.
I discovered that these crashes only occur with certain versions of the emulator application, i.e. it is possible to avoid the crash.
Thankfully, the Jenkins plugin lets you select the emulator binary to run.
So you can work around this problem by going into your job configuration, pressing Advanced… in the emulator config and selecting the "emulator-arm" (or another) binary.
In addition to Christopher Orr's answer, there is another possible cause. In my environment, emulator -snapshot-list listed the size of my snapshot as "1.0G". The pattern that matches snapshots in the Android Emulator Plugin as of 2014-01-14 matches whole number megabyte values.
I submitted a pull request to address that cause.