6

I would like test our android applications via Jenkins. I configured everything, but i got this error message:

[android] Emulator did not appear to start; giving up

I found a solution for this problem from here

This one can have several reasons. One of them is listed in the error below. I didn't encounter this myself but I've read on stackoverflow while looking for a solution to my specific issue. It seems to be related to the revision of the android sdk tools. On windows there was a fix like stated in this ticket: https://issues.jenkins-ci.org/browse/JENKINS-10815 However there seems to be a similar issue on linux that isn't fixed yet (at least the ticket is still open): https://issues.jenkins-ci.org/browse/JENKINS-14901

Solution: The proposed solution in that ticket is to create a link with the name emulator (back original) towards the appropriate emulator-X bin.

I tried it and solved our problem, but only some builds, after that I got again this message. That's why i removed the android plugin and deleted the sdk folder, so i reinstall everything. After that there were 4 success builds. (Interesting, that i didn't create emulator link like than before) But it was all, the problem backed. I played with configuration and set 30 second delay for emulator start and checked the "delete emulator after build" option. I thought that the problem solved because I had 14!!! success build but the problem backed again :( And now there is a new error message too:

NAND: could not write file /tmp/android-jenkins/emulator-CaWkYU, File exists [android] Emulator did not appear to start; giving up

What are you thinking, what is the problem? With same setting sometimes success, sometimes not. Why?

Robertoq
  • 559
  • 1
  • 10
  • 21
  • This might help you: http://stackoverflow.com/questions/19955837/android-emulator-did-not-appear-to-start-giving-up – herbertD Dec 23 '15 at 08:04

3 Answers3

3

Finally i found the problem in the source code: AndroidEmulator.java

The adb connection timeout is 1min and it's fix:

 private static final int ADB_CONNECT_TIMEOUT_MS = 60 * 1000;

So i increment it to 5 mins, build a new plugin and installed and it solved my problem (~100 build without this problem)

Robertoq
  • 559
  • 1
  • 10
  • 21
  • How did you increase this? I found AndroidEmulator.class in a jar file - I'm not sure how to increase the tmeout from within there. – Utkarsh Sinha Mar 01 '14 at 15:02
  • 1
    @UtkarshSinha “build a new plugin” is a dead give away on how he increased it: Download the source, change it and recompile. – Martin Mar 03 '14 at 15:38
2

How many build executors do you have (default is 2)? I bet you can only have one emulator running on your Jenkins server at a time, when two jobs are trying to execute, one job is getting clobbered. If this is the case, you may want to consider the Heavy Build plugin to lock up all executors when an Android job goes by. Or use slaves.

Electrawn
  • 2,254
  • 18
  • 24
  • I always start builds manually when there is no build in progress. Now i added shell scripts into build steps, because the new idea is that the emulator process doesen't stop after build. – Robertoq Oct 14 '13 at 10:57
0

You can check pull request which has fixes for this issue. Before merging PR to the main repo and get new plugin version, just download project from the author's forked repo and run command:

mvn install

from the project root directory. After that take "android-emulator.hpi" file located in

"<project root>/target"

directory and update/install plugin from the Jenkins Web UI

Manage Jenkins -> Manage Plugins -> Advanced

then reboot Jenkins CI. In project configuration use option

"Build Environment" -> "Common Emulator Options" -> "Advanced" -> "Adb timeout"

set it to 300 sec, for instance.

ultraon
  • 2,220
  • 2
  • 28
  • 27