I'm trying to run for androidTests in CI process. I use VSTS build definition for this. Before testing I must start Android Emulator. I can use Shell script task for starting the emulator, but as I cannot start the process in background, the build flow cannot proceed to next step. I've tried all possibilities listed below:
nohup $ANDROID_HOME/tools/emulator @emulatorForUITests
nohup $ANDROID_HOME/tools/emulator @emulatorForUITests &
$ANDROID_HOME/tools/emulator @emulatorForUITests &
but the emulator is still running in foreground. Am I doing something wrong or is it VSTS security feature? How can I start the emulator in background?
UPDATE (answering questions in comments):
- Starting emulator in foreground blocks build process therefore it must be non-blocking (background) task. The emulator starts in foreground (in UI) anyway. If I start it using the same script, but directly from Terminal instead of VSTS, the emulator starts, tests are run, everything is ok
- I use my own agent (on macOS)
UPDATE2: build log from VSTS:
(...)
2017-07-14T10:11:31.8195010Z emulator: WARNING: userdata partition is resized from 550 M to 800 M
2017-07-14T10:11:31.8202870Z
2017-07-14T10:11:31.8217150Z Hax is enabled
2017-07-14T10:11:31.8230410Z Hax ram_size 0x40000000
2017-07-14T10:11:31.8246000Z HAX is working and emulator runs in fast virt mode.
2017-07-14T10:11:34.0594360Z coreaudio: Could not initialize record - Unknown Audiodevice
2017-07-14T10:11:34.0627730Z coreaudio: Could not initialize record - Unknown Audiodevice
2017-07-14T10:11:34.0649440Z audio: Failed to create voice `goldfish_audio_in'
2017-07-14T10:11:34.0671380Z qemu-system-i386: warning: opening audio input failed
2017-07-14T10:11:34.0875870Z coreaudio: Could not initialize record - Unknown Audiodevice
2017-07-14T10:11:34.0888750Z coreaudio: Could not initialize record - Unknown Audiodevice
2017-07-14T10:11:34.0902400Z audio: Failed to create voice `adc'
2017-07-14T10:11:34.5066290Z emulator: emulator window was out of view and was recentered
2017-07-14T10:11:34.5078580Z
As emulator is not a background process VSTS waits for emulator
process to finish.