Jenkins & Android emulator: the emulator did not start; give up

I would like to test our Android apps through Jenkins. I configured everything, but I got this error message:

[android] The emulator did not start; rejection

I found a solution to this problem from here

There may be several reasons for this. One of them is indicated in the error below. I did not come across this myself, but I read about stackoverflow, looking for a solution to my specific problem. This seems to be due to a revision of the sdk tools for android. The windows had the fix indicated on this ticket: https://issues.jenkins-ci.org/browse/JENKINS-10815 However, it seems that a similar problem on Linux has not yet been fixed (at least the ticket is still open) : https://issues.jenkins-ci.org/browse/JENKINS-14901

Solution . The proposed solution in this ticket is to create a link with a name emulator (back to the original) in the corresponding emulator-X container.

I tried and solved our problem, but only some assemblies, after which I received this message again. This is why I uninstalled the android plugin and deleted the sdk folder, so I reinstalled everything. After that there were 4 successes. (Interestingly, I did not create the emulator link as before). But that’s all, the problem was supported. I played with the setup and set a 30 second delay to start the emulator and checked the option "remove emulator after build". I thought the problem was resolved because I had 14 !!! success, but the problem got fixed again :( And now a new error message appears:

NAND: it is impossible to write the file / tmp / android -jenkins / emulator-CaWkYU, the file exists [android] The emulator did not start; rejection

What do you think is the problem? With the same setting, sometimes success, sometimes not. What for?

+6
source share
3 answers

Finally, I found the problem in the source code: AndroidEmulator.java

The adb connection timeout is 1 minute and it fixes:

private static final int ADB_CONNECT_TIMEOUT_MS = 60 * 1000; 

So, I increase it to 5 minutes, create a new plugin and install it, and it solved my problem (~ 100 build without this problem)

+3
source

How many build performers do you have (default is 2)? I bet you can only use one emulator on your Jenkins server at a time when two jobs are trying to complete, one job gets lost. If so, you might want to consider the Heavy Build plugin to block all artists when Android is running. Or use subordinates.

+2
source

You can check the migration request that has fixes for this problem. Before merging PR into the main repo and getting a new version of the plugin, just download the project from the author forked repo and run the command:

 mvn install 

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

 "<project root>/target" 

and update / install the plugin from the Jenkins web interface

 Manage Jenkins -> Manage Plugins -> Advanced 

then restart Jenkins CI. In the project configuration, use the option

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

set it, for example, for 300 seconds.

0
source

Source: https://habr.com/ru/post/955882/


All Articles