Reputation: 704
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?
Upvotes: 6
Views: 4367
Reputation: 2400
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.
Upvotes: 0
Reputation: 704
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)
Upvotes: 3
Reputation: 2254
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.
Upvotes: 2