Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins & Android emulator: Emulator did not appear to start; giving up

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?

like image 566
Robertoq Avatar asked Oct 13 '13 19:10

Robertoq


People also ask

What is Jenkins and how to use it?

What is Jenkins? Jenkins is a tool that is used for automation, and it is an open-source server that allows all the developers to build, test and deploy software. It works or runs on java as it is written in java.

What is Jenkins CI server?

This CI server runs in servlet containers such as Apache Tomcat. Jenkins facilitates continuous integration and continuous delivery in software projects by automating parts related to build, test, and deployment. This makes it easy for developers to continuously work on the betterment of the product by integrating changes to the project.

Why is Jenkins one of the leading DevOps tools today?

Continue reading to learn more about Jenkins and why it's one of the leading DevOps tools today. Jenkins is an automation server written in Java that helps build, test, and continually deploy software. The open-source system is currently one of the leading automation servers. Various version control tools such as Git.

Is Jenkins the best open source automation server?

With over 200,000 installations to date, Jenkins remains the most widely used open-source automation server. And story after story, we hear what a critical role Jenkins plays in building robust, secure CI/CD pipelines. So it comes as no surprise that in many of...


2 Answers

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)

like image 122
Robertoq Avatar answered Sep 19 '22 12:09

Robertoq


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.

like image 35
Electrawn Avatar answered Sep 23 '22 12:09

Electrawn