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

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

我正在尝试为我的 existing Android project. 设置 Travis CI 我已经添加了 .travis.yml:

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

但它在 Travis CI 中总是失败,并出现以下错误:

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.

我应该怎么做才能摆脱这个错误?


更新:
将构建工具更新到版本 22.0.1 后,此错误消失但出现新错误:

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

在我的build.gradle中:

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

知道如何解决这个问题吗?

谢谢!

您需要将构建工具更新到 22.X 版本,我已经在我的项目配置中尝试过,并且可以。

android:
  components:
    - android-22
    - build-tools-22.0.1

也有可能 Travis 尚未使用适当的 sdk 进行更新。来自 their docs(截至 2015 年 6 月 9 日):

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

那里没有提到 v22 sdk 或构建工具。

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