kutzilla
kutzilla

Reputation: 33

Jenkins cannot connect to android emulator

I'm using Jenkins for continous integration on an android emulator to run instrumentation tests with the espresso framework. Unfortunately the server is not able to connect to the emulator. I have a master instance which delegates the push events from GitHub to the slave instance where the android sdk is installed. I installed the android-emulator-plugin and configured it like described. At first the Jenkins starts the emulator, but it cannot connect to it afterwards. This is the result:

enter image description here

I also cannot connect to the emulator when I'm on the slave machine. But if I use 127.0.0.1 instead of localhost the adb tool can connect to the emulator:

enter image description here

Is it possible to use 127.0.0.1 instead of localhost with the android-emulator-plugin? I already specified the enviorment variables $ANDROID_AVD_DEVICE and $ANDROID_SERIAL with no result. Any ideas?

Upvotes: 1

Views: 802

Answers (2)

kutzilla
kutzilla

Reputation: 33

I fixed the problem by myself. I have checked out a fork on GitHub, which uses 127.0.0.1 instead of localhost. This did work for connecting to the emulator but not for running the instrumentation tests. I do not use Jenkins plugins for the connection anymore. I make the build with a shell script which contains all commands to start the AVD and the gradle tasks. Works fine for me. But thank you for the advice. Maybe I will try to comment ipv6 aswell, if I have the time to work on the Jenkins.

Upvotes: 0

kriloleg
kriloleg

Reputation: 59

I was fighting with it whole day. Just try to comment ipv6 in your /etc/hosts.

Upvotes: 1

Related Questions