Just untick the "Show emulator window" configuration option in your job configuration. This is the equivalent of using the emulator's "
-no-window" command-line option.
|title||See how to use Using an artificial graphical environment...|
It is also possible to run the Android emulator UI on a headless build slave by making use of an articifial X server, such as Xvnc.
In this case, a recommended setup is to install both Xvnc and the Xvnc Plugin for Jenkins. With this plugin enabled in your job — and Xvnc configured to run without requesting a password — you can run multiple Android emulators in parallel on a headless slave, while keeping the "Show emulator window" option enabled.
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.
The full emulator log is captured for the complete duration of a build. This corresponds to the output of "
adb logcat -v time", i.e. the main log output including timestamps.
This will be archived automatically as a build artifact, with the name
Running in a Windows service as "Local System"
New AVDs cannot be generated and run if Jenkins is running as a Windows service, using the "Local System" account (see JENKINS-7355).
- Workaround: configure the Jenkins service to "run as" a real user
Unexpected timeouts or hanging during build
AVDs can, on occasion, time-out unexpectedly or stop responding during a build, e.g. when trying to install an APK (see JENKINS-7354).
- This is generally caused by bugs in the ADB process. It can be prone to hanging or crashing. Over time, more safeguards have been added to the plugin, including timing-out after a while and isolating ADB instances, so this shouldn't happen too often.
AVDs may not shut down fully at the end of a build
emulator process does not shut down fully at the end of a build (requiring a
kill -9 on Linux); the plugin sends a console command to terminate the emulator and the UI window closes, but the actual
emulator process does not die.
- This issue will be fixed once JENKINS-11995 is implemented.
- If your slave is running Linux, you may be running into Android issue #17294
In this case, there is a workaround assuming your build doesn't need to use the emulator's audio input:
- Add a custom hardware property called "
hw.audioInput" with the value "
Potential upcoming features
- Added automated installation of Android SDK, build tools and OS images
- Where the SDK is already installed, prerequisites can be automatically installed, e.g. OS images, SDK add-ons
- Automated installation of Android 4.0 system images will be possible when SDK Tools r17 is released (see Android bug #21880)
- HTTP proxy support is not yet included
- Thanks to Raphaël Moll at Google for implementing our feature requests!
- Each build now runs its own instance of ADB, giving more stability and prevents ADB crashes from affecting parallel builds (JENKINS-10148)
- Thanks to Jørgen Tjernø for the idea and patch!
- Added option to delete the emulator when a build ends
- Added detection of missing ABIs (e.g. required for Android 4.0+) (JENKINS-11516)
- Added support for Android 4.0.3
- Relaxed the rules for determining whether a screen resolution alias is valid or not
- More hints are given at configuration time to help ensure an appropriate screen resolution is entered
- Fixed variable expansion where an existing environment variable clashed with a build variable
- Temporary log files are now stored outside of the workspace (JENKINS-11492)
- Connections to the emulator are now made via TCP, which makes startup from snapshot more stable (JENKINS-11952)
- Made snapshot more likely to succeed on Windows
Version 1.18 (September 12, 2011)
- Fixed bug introduced by Android SDK Tools r12, where emulator startup was not detected properly on Windows (JENKINS-10815)
- Fixed bug where build would get stuck during emulator startup if
adb hangs (JENKINS-10421)
- Fixed bug where logcat processes were not always killed at the end of a build (JENKINS-10785)
- Made emulator shutdown more robust and prevent builds from hanging if the emulator is unresponsive (JENKINS-10778)
- Thanks for Richard Mortimer for the investigation and fixes
Version 1.17 (August 25, 2011)
- Added ability to use variables when specifying the package ID to run monkey against
- Minor monkey fixes and improvements
Version 1.16 (August 19, 2011)
- Added support for Android 3.2
- Added ability to specify the psuedo-random seed value used when running monkey (including random and time-based values)
- Stopped redundant logcat output from being included for each build when using snapshots (JENKINS-9831)
- Changed startup behaviour to allow manual management of snapshots while the emulator is running (JENKINS-10422)
Version 1.15 (May 20, 2011)
- Added support for Android 3.1
- Export ANDROID_SERIAL environment variable, making it easier to use
- Fixed bug where an APK with spaces in its filename could not be installed (JENKINS-9700)
- Fixed regression in config UI, where checkbox states weren't shown properly (JENKINS-9747)
Version 1.14 (May 13, 2011)
- Added logic to ensure multiple builds which need the same AVD will not run in parallel on the same machine (see JENKINS-7353)
- Thanks to Kohsuke Kawaguchi and Andrew Bayer for the assistance
- Added new build step that runs the monkey testing tool on an emulator or device
- Added a result publisher that parses monkey tool output, publishes a summary on the build page and updates the build result accordingly
Version 1.13 (Apr 20, 2011)
- Fixed bug where snapshots would not function with "Show window" disabled (see JENKINS-9462)
Version 1.12 (Apr 08, 2011)
- Fixed bug which caused creation of a brand new emulator to fail if snapshots were enabled
Version 1.11 (Apr 07, 2011)
- Added automated reconnection of the emulator to ADB during startup, in case ADB crashes (see JENKINS-7693)
- Now connects to ADB in the same way that manually-started emulators do, potentially also improving stability
Version 1.10 (Apr 04, 2011)
- Added automated support for emulator snapshots (added in SDK Tools r9), which enables much faster start-up times
- Fixed bug which could prevent jobs from starting when SDK Tools version r7 or older was installed
Version 1.9 (Mar 06, 2011)
- Added new build step that can install an APK on an emulator or device
- Added new build step that can uninstall an APK from an emulator or device
Version 1.8.1 (Feb 23, 2011)
- Added support for Android 3.0, including WXGA resolution (1280x800) and new locales
Version 1.8 (Feb 21, 2011)
- Added ability to set custom hardware properties such as device RAM, Dalvik heap size, keyboard present etc. (see JENKINS-8124)
Version 1.7 (Feb 09, 2011)
- Added support for Android 2.3.3
- Improve detection of failures during startup, plus improved logging and minor cleanups
Version 1.6 (Dec 26, 2010)
- Added ability to set arbitrary command line options when starting the emulator (see JENKINS-8125)
Version 1.5 (Dec 17, 2010)
- Added support for Android 2.3 and the xhdpi screen density
- Added detection to handle the new "platform-tools" directory used in SDK Tools r8
- Added detection of when AVD creation fails due to the desired platform not being installed
- Improved automated emulator unlocking to be more reliable, particularly on slower machines
- Fixed bug which could cause build to hang when trying to shut-down the emulator
Version 1.4 (Sep 28, 2010)
- Added feature to automatically unlock emulator after startup has completed (see JENKINS-7185)
- Now tries to shut down emulator instances in a cleaner (hopefully more reliable) fashion
Version 1.3.1 (Sep 01, 2010)
- Fixed bug that prevented custom screen resolutions from being recognised (see JENKINS-7337)
- When verifying whether an AVD exists, ensure we check the same directory that the
android tool creates AVDs in
- It was possible in some environments (more likely Windows) that this was not the case
Version 1.3 (Jul 18, 2010)
- Added ability to control whether AVDs have an SD card, and its size
- Added option to reset emulator to its default state before each build
- Added option allowing emulator UI to be hidden during a build
- Added option to delay emulator start-up by a configurable period, e.g. to allow a VNC server to start up (see JENKINS-6912)
Version 1.2 (Jun 17, 2010)
- Fixed crash that sometimes occurred when creating an emulator.
- Added more logging and error handling while creating an emulator.
- Fixed bug that would prevent emulators from starting.
- Added support for Android 2.2.
Version 1.1 (May 18, 2010)
- Added ability to create an AVD using platform add-ons (e.g. the Google Maps APIs)
- Generated AVDs now include a blank SD card image (currently fixed at 16MB)
Version 1.0.3 (Apr 06, 2010)
- Ensure correct environment variables are used when starting the emulator. Fixes a problem where the emulator may not start under the Xvnc Plugin
Version 1.0.2 (Apr 06, 2010)
- Added environment variables with ADB identifier, ports and skin being used
- Ensured correct skins are used for new AVDs
Version 1.0.1 (Apr 06, 2010)
- Fix minor Java 5 compatibility issue
Version 1.0 (Apr 05, 2010)