I'm trying to set up travis CI for my application with Detox as the test suite. I'm close to achieving the final setup, but I'm currently stuck on the following error which occurs during the final step of the build (testing phase, since the android.emu.release configuration builds successfully, though slowly). Note that my android.emu.debug configuration runs tests perfectly.
Here's the error, which says that "-read-only" is not a valid option for the emulator command.
5.66s$ npx detox test --headless -c android.emu.release --gpu swiftshader --cleanup
detox[6696] INFO: [test.js] configuration="android.emu.release" cleanup=true gpu="swiftshader" headless=true reportSpecs=true readOnlyEmu=false DETOX_START_TIMESTAMP=1578027757256 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 "e2e"
detox[6708] INFO: [DetoxServer.js] server listening on localhost:38035...
detox[6708] ERROR: [Emulator.js/SPAWN_FAIL] `/usr/local/android-sdk/tools/emulator -verbose -no-audio -no-boot-anim -no-window -read-only -port 17944 @pixel9 -gpu swiftshader` failed with code 1
err: ChildProcessError: `/usr/local/android-sdk/tools/emulator -verbose -no-audio -no-boot-anim -no-window -read-only -port 17944 @pixel9 -gpu swiftshader` failed with code 1
at ChildProcess.<anonymous> (/home/travis/build/uva-cp-1920/PowerShare/src/PowerShare/node_modules/child-process-promise/lib/index.js:132:23)
at ChildProcess.emit (events.js:305:20)
at maybeClose (internal/child_process.js:1028:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
detox[6708] ERROR: [Emulator.js/SPAWN_FAIL] unknown option: -read-only
please use -help for a list of valid options
To reproduce the issue locally:
To reproduce the issue in the travis environment, I follow the "script" commands:
Environment (please complete the following information):
For reference, my travis.yml file is
env:
global:
- NODE_VERSION=stable
matrix:
include:
- language: android
cache: yarn
jdk: oraclejdk8
dist: trusty
sudo: required
android:
components:
- build-tools-28.0.3
- android-28
- sys-img-x86-android-28
install:
- echo no | android create avd --force -n pixel9 -t android-28 --abi default/x86
- curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
- sudo apt-get install -y nodejs
script:
- cd src/PowerShare/
- yarn
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- npx detox build -c android.emu.release
- npx detox test --headless -c android.emu.release --gpu swiftshader --cleanup
Is there any more information I can provide in order to speed up the resolution of this bug/error? Thanks!
Also having problems with android tests on CI. Someone who knows any working android example that successfully runs on any CI at the moment?
It appears the -read-only arg is somehow passed-in to the emulator's bin by Detox even though you haven't specified parallel-execution args. That means it's an actual bug.
As a workaround, try to use a newer emulator version (28.0.16 min). I suppose that with travis, the version is selected according to the build-tools version you've specified in the .yml:
android:
components:
- build-tools-28.0.3
But I can't tell for sure.