2

Using Jenkins on Ubunut Server 16.04 with Android Emulator Plugin, I managed to get it working when I set the OS Version to "android-19". Below a short screenshot from the settings:

enter image description here

While this works for the plugin and the emulator, my application needs Google Play Services to run correctly. Searching for an image of android with Google APIs (which sounds like what I need) I endedup in the plugin's help page as it says:

As mentioned above, the "Android OS version" field will auto-complete to existing SDK versions such as "1.5" or "2.2". However, it is possible to enter different values in this field, for example if you want to use an Android SDK add-on that you have installed, e.g. the Google APIs add-on or the Samsung GALAXY Tab add-on. In these cases, just enter the appropriate value given by the "android list target" command.

For example: The Google APIs add-on, based on an Android 1.6 emulator: Google Inc.:Google APIs:4

So I tried fill Android OS Version with: Google Inc.:Google APIs:19, only to find that I had some problems with the Target ABI. Searching further I found that when using this naming of OS, I must add a tag before Target ABI. It should be: "google_apis/armeabi-v7a"

The settings then looked like:

enter image description here

But when I build, I get a long console terminal message of waiting for the emulator to start, which looks like never happens:

$ /var/lib/jenkins/tools/android-sdk/tools/android list target
[android] Using Android SDK: /var/lib/jenkins/tools/android-sdk
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
* daemon not running. starting it now at tcp:5825 *
* daemon started successfully *
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
[android] Starting Android emulator
$ /var/lib/jenkins/tools/android-sdk/tools/emulator -engine classic -ports 5782,5783 -report-console tcp:5836,max=60 -prop persist.sys.language=pt -prop persist.sys.country=BR -avd hudson_pt-BR_160_WQVGA_Google_Inc._Google_APIs_19_google_apis-armeabi-v7a_testing2 -no-snapshot-load -no-snapshot-save -no-window
WARNING: Force to use classic engine to support snapshot.
ERROR: resizing partition e2fsck failed with exit code 8
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
emulator: warning: opening audio output failed

emulator: WARNING: Requested adb port (5783) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
emulator: Listening for console connections on port: 5782
emulator: Serial number of this emulator (for ADB): emulator-5782
[android] Emulator reported that the console is available on port 5,782
[android] Waiting for emulator to finish booting...
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
[android] Timed-out after waiting 360 seconds for emulator
[android] Stopping Android emulator

The [android] Emulator reported that the startup process is '', with Android OS Version android-19, appears as [android] Emulator reported that the startup process is 'running' but with Google APIs it doesn't seems to start.

What am I setting wrong?

Fabiano Araujo
  • 876
  • 6
  • 19

1 Answers1

0

I'm looking into a similar issue. You're #1 issue is that the emulator is trying to connect to an adb port that doesn't exist.

$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server daemon not running. starting it now at tcp:5825

/var/lib/jenkins/tools/android-sdk/tools/emulator -engine classic -ports 5782,5783 -report-console tcp:5836,max=60 -prop persist.sys.language=pt -prop persist.sys.country=BR -avd hudson_pt-BR_160_WQVGA_Google_Inc._Google_APIs_19_google_apis-armeabi-v7a_testing2 -no-snapshot-load -no-snapshot-save -no-window WARNING: Force to use classic engine to support snapshot.

If you can get those ports to match it should work. My guess is that there's a issue with the plugin. Possible some file permissions issues or what ever in the plugin is designed to make the ports match between executions. There is a environment variable where you can specify the adb server port. I'm new to jenkins and haven't gotten it to work yet.

kolobcreek
  • 53
  • 6
  • Started to dig into the jenkins android plugin source. From a brief look one of the ports was auto generated. Probably some disconnect there. Our work around was to start adb server with **-P** flag set the env variable **ANDROID_ADB_SERVER_PORT**. This env variable works for emulator and adb when running gradle connectedAndroidTest – kolobcreek Jul 18 '19 at 21:30