Travis CI for Android - 构建错误:找不到目标 &找不到依赖项



我正试图为我现有的Android项目设置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.
...

在我的构建。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。从他们的文档(截至2015年6月9日):

预安装组件#

虽然下列组件是预安装的,但确切的列表可能会在不事先通知的情况下更改。为了确保构建环境的稳定性,我们建议您显式地指定项目所需的组件。

  • 平台工具
  • 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

最新更新