machine:
  java:
    version: openjdk8
dependencies:
  pre:
    - echo y | android update sdk --no-ui --all --filter tools,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-23
    - echo y | android update sdk --no-ui --all --filter build-tools-23.0.2
test:
  pre:
    # start the emulator
    - emulator -avd circleci-android22 -no-audio -no-window:
        background: true
        parallel: true
    # wait for it to have booted
    - circle-android wait-for-boot
  override:
    - fb-adb start-server:
        background: true
    - ./gradlew test assembleDebug --console=plain
    # Unlock the lockscreen on the emulator
    - fb-adb shell input keyevent 82
    - fb-adb shell input keyevent 92
    - ./gradlew connectedAndroidTest --console=plain
  post:
    - cp -r app/build/outputs $CIRCLE_ARTIFACTS
    # copy the test results to the test results directory.
    - find app/build/test-results -name "*.xml" -exec cp {} $CIRCLE_TEST_REPORTS/ \;
    - cp -r app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS

machine:
  java:
    version: openjdk8
dependencies:
  pre:
    - echo y | android update sdk --no-ui --all --filter tools,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-23
    - echo y | android update sdk --no-ui --all --filter build-tools-23.0.2
test:
  pre:
    # start the emulator
    - emulator -avd circleci-android22 -no-audio -no-window:
        background: true
        parallel: true
  override:
    - fb-adb start-server:
        background: true
    # Run robolectric tests, build the apk, and build the test apk for running
    # the espresso tests
    - ./gradlew test assembleDebug assembleDebugAndroidTest --console=plain
    # wait for the emulator to have booted
    - circle-android wait-for-boot
    # Run espresso tests
    - ./gradlew connectedAndroidTest --console=plain
  post:
    - cp -r app/build/outputs $CIRCLE_ARTIFACTS
    # copy the test results to the test results directory.
    - find app/build/test-results -name "*.xml" -exec cp {} $CIRCLE_TEST_REPORTS/ \;
    - cp -r app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS

Remove redundant lockscreen unlock commands, restructure commands
Remove redundant lockscreen unlock commands, restructure commands
