1

I'm trying to set up a CI build for my Android development (Android SDK Tools V23.0.2). This is currently all running on my local machine (with Ubuntu 14.04.1). However, I have problems getting the emulator to work properly.

From within Eclipse, I can launch the emulator, and it works fine (and even quite fast). The only minor issue I had was that screenshots (taken with Robotium) would not work until I switched off the emulator's "Use Host GPU" option.

On Jenkins (V1.576), I use the "Android Emulator plug-in" (V2.11.1), and here the fun starts. First of all, I can start the emulator, but only with android-15 - for every version above that one, the emulator doesn't appear to start. Second, the emulator is much slower than when started from within Eclipse - for instance, one of my tests takes 1min on the Eclipse emulator, and about 3-4mins on the "Jenkins" emulator. Third, screenshots do not work at all, even without using the "Use Host GPU" option. Fourth, I'm not able to launch the emulator with a window (in fact, I do not want to in the long run, but it would be handy to see what's going on while setting up the build).

I tried to play with all kinds of plug-in configurations (including explicitly stating the emulator executable, e.g. "emulator64-x86"), and I have also tried to reuse the AVD specification used by Eclipse, but that all wouldn't help. For the sake of completeness, I have attached my working Eclipse and plug-in configurations below, but I guess that my actual question is:

How can I make the "Android Emulator plug-in" start the emulator exactly the same way as Eclipse starts it?

Despite that, I would of course be happy about all kinds of help - this is kind of driving me nuts :-)

Here's a screenshot of the AVD configuration I use within Eclipse:

Screenshot of AVD config

Here's the Jenkins output of my successfully starting emulator:

[android] Using Android SDK: /home/chris/android-sdks
[android] Creating Android AVD: /var/lib/jenkins/jobs/PracticingTimer - Large Tests/workspace/.android/avd/hudson_de-DE_320_1280x768_android-15_x86.avd
[android] /home/chris/android-sdks/tools/android create avd -f -a -c 256M -s 1280x768 -n hudson_de-DE_320_1280x768_android-15_x86 -t android-15 --abi x86
[android] Setting hardware properties:
    hw.ramSize: 512
    vm.heapSize: 64
$ /home/chris/android-sdks/platform-tools/adb start-server
[android] Starting Android emulator
$ /home/chris/android-sdks/tools/emulator -no-boot-anim -ports 5593,5594 -prop persist.sys.language=de -prop persist.sys.country=DE -avd hudson_de-DE_320_1280x768_android-15_x86 -no-snapshot-load -no-snapshot-save -no-window
* daemon not running. starting it now on port 5595 *
* daemon started successfully *
Failed to Initialize backend EGL display
$ /home/chris/android-sdks/platform-tools/adb connect emulator-5593
[android] Waiting for emulator to finish booting...
$ /home/chris/android-sdks/platform-tools/adb -s emulator-5593 shell getprop dev.bootcomplete
error: device offline
error: device offline
$ /home/chris/android-sdks/platform-tools/adb connect emulator-5593
$ /home/chris/android-sdks/platform-tools/adb -s emulator-5593 shell getprop dev.bootcomplete
error: device offline
error: device offline
$ /home/chris/android-sdks/platform-tools/adb connect emulator-5593
$ /home/chris/android-sdks/platform-tools/adb -s emulator-5593 shell getprop dev.bootcomplete
$ /home/chris/android-sdks/platform-tools/adb disconnect emulator-5593
$ /home/chris/android-sdks/platform-tools/adb connect emulator-5593
$ /home/chris/android-sdks/platform-tools/adb -s emulator-5593 shell getprop dev.bootcomplete
$ /home/chris/android-sdks/platform-tools/adb -s emulator-5593 logcat -v time
$ /home/chris/android-sdks/platform-tools/adb connect emulator-5593
[android] Emulator is ready for use (took 48 seconds)

Here's some failing "Android Emulator plug-in" settings (as text for brevity):

Run emulator with properties
  OS: android-19
  Screen density: 320
  Screen resolution: 1280x768
  Device locale: de_DE
  SD card size: 128M
  Target ABI: x86
  vm.heapSize=64
  hw.ramSize=512
  Reset emulator at startup
  Show emulator window

And finally, here's the Jenkins output resulting from a failing emulator start:

[android] Using Android SDK: /home/chris/android-sdks
[android] Setting hardware properties:
    vm.heapSize: 64
    hw.ramSize: 512
$ /home/chris/android-sdks/platform-tools/adb start-server
[android] Starting Android emulator
[android] Erasing existing emulator data...
$ /home/chris/android-sdks/tools/emulator -no-boot-anim -ports 5749,5750 -prop persist.sys.language=de -prop persist.sys.country=DE -avd hudson_de-DE_320_1280x768_android-19_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 5751 *
* daemon started successfully *
[android] Emulator did not appear to start; giving up
$ /home/chris/android-sdks/platform-tools/adb disconnect emulator-5749
[android] Stopping Android emulator
$ /home/chris/android-sdks/platform-tools/adb kill-server
Finished: NOT_BUILT
4

0 回答 0