'Run Android Emulator with Jenkins Pipeline on Windows

I am using a Android Emulator to run some tests where a need to send some information with adb commands so I created a Pipeline where the first stage is running the emulator with this command in the pipeline

bat 'emulator -avd Pixel_2_Test -no-window -no-audio wait-for-device'

When I use this command the job breaks, I think beacause is a daemon, so I tried to use start in the begin of the command to execut in backgroud, so in the next step I have:

bat 'adb devices'

I have this to see if the emulator is running but never return nothing, only never stop this step. I have to finished the job manually. I don't know if the emulator is really runing on background mode and I dont know why the adb command never stop. Please help me. I dont know how to run this emulator on the pipeline on Windows



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source