Travis CI for Android - Build Error: Failed to find target & Could not find dependencies

1.6k views Asked by At

I am trying to set up Travis CI for my existing Android project. I've added the .travis.yml:

language: android
android:
  components:
    - build-tools-21.1.2
    - android-22
    - extra-google-google_play_services

But it always fails in Travis CI with the following error:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':evercamPlay'.
failed to find target android-22 : /usr/local/android-sdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or debug option to get more log output.
BUILD FAILED
Total time: 16.801 secs
The command "./gradlew build connectedCheck" exited with 1.
Done. Your build exited with 1.

What should I do to get rid of this error?


Update:
After updating build tools to version 22.0.1, this error is gone but got new error:

> Could not find com.android.support:support-v4:22.2.0.
...
> Could not find com.google.android.gms:play-services:7.3.0.
...

In my build.gradle:

dependencies {
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.google.android.gms:play-services:7.3.0'
}

Any idea how to fix this?

Thanks!

3

There are 3 answers

5
Sandro Machado On BEST ANSWER

You need to update the build tools to the version 22.X, I have tried in my project configuration and that works.

android:
  components:
    - android-22
    - build-tools-22.0.1
4
stkent On

It's also possible that Travis hasn't been updated with the appropriate sdks yet. From their docs (as of June 9, 2015):

Pre-installed components #

While the following components are preinstalled, the exact list may change without prior notice. To ensure the stability of your build environment, we recommend that you explicitly specify the required components for your project.

  • platform-tools
  • build-tools-21.1.1
  • android-21
  • sys-img-armeabi-v7a-android-21
  • android-20
  • sys-img-armeabi-v7a-android-wear-20
  • android-19
  • sys-img-armeabi-v7a-android-19
  • android-18
  • sys-img-armeabi-v7a-android-18
  • android-17
  • sys-img-armeabi-v7a-android-17
  • android-16
  • sys-img-armeabi-v7a-android-16
  • android-15
  • sys-img-armeabi-v7a-android-15
  • android-10
  • extra-android-support
  • extra-google-google_play_services
  • extra-google-m2repository
  • extra-android-m2repository

No mention of v22 sdk or build tools there.

0
albodelu On
language: android
    android:
      components:
        - platform-tool
        - tool
        - android-22
        - build-tools-22.0.1
        - extra-android-m2repository
        - extra-google-m2repository