I’m trying to run robotium UI tests on an Android emulator, but every test fails with this message
Injecting to another application requires INJECT_EVENTS permission
I’ve tried adding sleep before and after unlocking the screen, but nothing works.
Here is my circle.yml file
general:
artifacts:
- app/build/outputs/apk
machine:
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
java:
version: oraclejdk8
pre:
- echo y | android update sdk --no-ui --all --filter "tool,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-25"
- echo y | android update sdk --no-ui --all --filter "build-tools-25.0.3"
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
# Unlock the lock screen
- adb shell input keyevent 82
- adb shell input keyevent 111
# Run tests
- ./gradlew connectedFreeDebugAndroidTest -PdisablePreDex
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/build/reports/.*" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;