0

I've read through com.android.builder.testing.ConnectedDevice > hasTests[test(AVD) - 5.0] FAILED and I am having a very similar problem. Unfortunately, it's very difficult to discern what the actual solution to that problem was, given all of the discussion the solution author gave.

Essentially, I have the following .travis.yml file:

language: android

android:
  components:
  - build-tools-21.1.0
  - android-19
  - extra-google-google_play_services
  - extra-google-m2repository
  - extra-android-m2repository
  - addon-google_apis-google-19
  - addon-google_apis-google-21
  - sys-img-armeabi-v7a-android-19

before_script:
  - echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
  - emulator -avd test -no-skin -no-audio -no-window &
  - cat `which android-wait-for-emulator`
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

script: ./gradlew clean build connectedCheck

When I push, and travis builds the appropriate .apk, I end up with the following log: http://pastebin.com/LVw5rG58

If I run ./gradlew clean build installDebug, the build turns out fine, so it doesn't appear to be an issue with the timeout being too short in the android-wait-for-emulator script (also, it's using the newer version, I've checked - see the cat which android-wait-for-emulator command in the .travis.yml.

Additionally, I do have a single test in my source repository, and running ./gradlew clean build connectedCheck on my local development machine (with a phone attached) works fine.

This just started happening since I updated gradle to 2.2.1 and updated the build tools to 21.1.0. However, I have another project using the exact same .travis.yml that isn't failing for some reason.

Edit:

My application has the following directory structure:

wagebase-android/
  - WageBase/
    - src/
      - androidTest/
        - java/
          - com.thisclicks.wagebase/  <- Test Sources
      - main/
        - java/
          - com.thisclicks.wagebase/ <- App sources

Edit:

It appears that if I run this on a local emulator, it also fails with the same error. I used the same configuration as in Travis, i.e.:

$ echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
$ emulator -avd test -no-skin -no-audio -no-window &
$ adb wait-for-device
$ ./gradlew connectedCheck
Community
  • 1
  • 1
jwir3
  • 6,019
  • 5
  • 47
  • 92

1 Answers1

0

About Unable to find instrumentation target package: com.thisclicks.wagebase:

If wagebase is a Project Library, check the first response, otherwise the second response here: unable-to-find-instrumentation-target-package-com-xyz.

You have to create and setup an Application Project that depends on the Library Project, in order to test the Library Project.

When you create android test project remember to set good target package

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test" <-------------------

If you run gradle installDebug --debug you'll know more about the error (share the log here), perhaps an installation issue. And you can show androidTest logs as I do here, line 3848

cat ${TRAVIS_BUILD_DIR}/*/build/outputs/androidTest-results/connected/*

About dependencies, I think that you don't need extra-google-google_play_services included in extra-google-m2repository. You can check a working travis.yml file for google apis here.

android:
  components:
    - build-tools-21.1.2
    - android-21
    - addon-google_apis-google-21
    - extra-google-m2repository
    - extra-android-m2repository
    - sys-img-armeabi-v7a-addon-google_apis-google-21

before_install:
  - echo no | android create avd --force -n test -t "Google Inc.:Google APIs:21" --abi google_apis/armeabi-v7a
Community
  • 1
  • 1
albodelu
  • 7,931
  • 7
  • 41
  • 84