Android basic tests fail, no builds/outputs directory created

I’m using a pretty simple circle.yml (roughly based on the sample provided in the docs) and I am not getting anything in the build/outputs directory.

Here is my circle.yml:

test:
override:
# start the emulator
- emulator -avd circleci-android24 -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
# run tests against the emulator.
- ./gradlew connectedAndroidTest
# copy the build outputs to artifacts
- cp -r my-project/build/outputs $CIRCLE_ARTIFACTS
# copy the test results to the test results directory.
- cp -r my-project/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS

deployment:
beta:
branch: develop
commands:
- ./gradlew uploadReleaseToHockeyApp

After my tests appear to run just fine I get this:

cp -r my-project/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS
cp: cannot stat ‘my-project/build/outputs/androidTest-results/*’: No such file or directory

cp -r my-project/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS returned exit code 1

Any ideas why the tests are not outputting anything in the build/outputs folder and/or how I can fix it?

I basically just included the sample circle.yml in the docs:

https://circleci.com/docs/1.0/android/

Seems like there is some sort of issue with the default emulator or run configuration. Anybody have ideas? The tests work and output to the build/outputs folder on my local machine (MacOS 10.11.5 running Android Studio 2.2.3, Android SDK Tools 25.2.5).

For the build artifact, it looks like you’re missing: ./gradlew assembleRelease.

You will also need to call ./gradlew test before collecting the reports.

Please give that a try and let us know!

Best, Zak

1 Like