Android 24: Found 1 connected device(s), 0 of which were compatible

android

#1

I’m trying to migrate an Android project to CircleCI, but I’m running into this error when trying to run my “connected” tests:

MYPROJ > : No compatible devices connected.[TestRunner] FAILED 
> Building 99% > :MyProject:connectedMyprojDebugAndroidTest Found 1 connected device(s), 0 of which were compatible.
:MyProject:connectedMyprojDebugAndroidTest FAILED

I’m not sure why I am getting this error or how to solve this issue. Any help or tips to get me headed in the right direction would be appreciated!

My build.gradle specifies the following attributes:

compileSdkVersion 24
buildToolsVersion '24.0.2'
minSdkVersion 19
targetSdkVersion 24

Here is my circle.yml:

dependencies:
  pre:
    - echo y | android update sdk --no-ui --all --filter tools
    - echo y | android update sdk --no-ui --all --filter platform-tools
    - echo y | android update sdk --no-ui --all --filter extra-android-m2repository
    - echo y | android update sdk --no-ui --all --filter extra-android-support
    - echo y | android update sdk --no-ui --all --filter extra-google-google_play_services
    - echo y | android update sdk --no-ui --all --filter extra-google-m2repository
    - echo y | android update sdk --no-ui --all --filter android-24
    - echo y | android update sdk --no-ui --all --filter build-tools-24.0.2
    - echo y | android update sdk -a -u -t sys-img-armeabi-v7a-google_apis-24
    - android list targets
test:
  override:
    # start the emulator
    - echo no | android create avd -n custom-android24-googleapis -t "android-24" --abi google_apis/armeabi-v7a
    - android list avd
    - emulator -avd custom-android24-googleapis -no-window:
        background: true
        parallel: true
    # wait for it to have booted
    - circle-android wait-for-boot
    # run unit tests
    - ./gradlew testMyprojDebug -PdisablePreDex
    # run tests against the emulator.
    - ./gradlew connectedMyprojDebugAndroidTest

#2

I think this has to be 24. It might work with 23. I understand that this leaves no backwards compatibility, but something about adding in the google apis doesn’t seem to like older versions of the sdk.


#3

Unfortunately, I don’t think this solution will work for me. I still need to allow users to install the app who have SDK version 19.


#4

Alright, I changed my configuration around so that I am still installing the API 24 SDK and build tools, but I am using an API 22 emulator:

dependencies:
  pre:
    - echo y | android update sdk --no-ui --all --filter android-24
    - echo y | android update sdk --no-ui --all --filter build-tools-24.0.2
test:
  override:
    - emulator -avd circleci-android22 -no-audio -no-window:
        background: true
        parallel: true
    # ...

However, now I’m running into a different error:

> Building 99% > :MyProject:connectedMyprojDebugAndroidTest:MyProject:connectedMyprojDebugAndroidTest
Tests on circleci-android22(AVD) - 5.1 failed: Instrumentation run failed due to 'java.io.FileNotFoundException'
> Building 99% > :MyProject:connectedMyprojDebugAndroidTest
com.android.builder.testing.ConnectedDevice > No tests found.[circleci-android22(AVD) - 5.1] FAILED 
> Building 99% > :MyProject:connectedMyprojDebugAndroidTestNo tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).

Right now I have one “connected” test that I am able to run in my local development environment by running the same Gradle task that I’m using in my circle.yml config.

Not sure what would be causing this error. Seems like there’s something specific to my local development environment that makes it work but that CircleCI does not know about.

Any ideas of how to fix this issue?


#5