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

时间:2015-06-09 10:51:26

标签: android android-gradle travis-ci

我正在尝试为我的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'
}

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

谢谢!

3 个答案:

答案 0 :(得分:6)

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

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

答案 1 :(得分:2)

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

  

预装组件#

     

虽然预装了以下组件,但确切列表可能会更改,恕不另行通知。为确保构建环境的稳定性,我们建议您明确指定项目所需的组件。

     
      
  • 平台的工具
  •   
  • 构建工具-21.1.1
  •   
  • 机器人-21
  •   
  • SYS-IMG-armeabi-V7A-机器人-21
  •   
  • 机器人-20
  •   
  • SYS-IMG-armeabi-V7A-机器人磨损-20
  •   
  • 机器人-19
  •   
  • SYS-IMG-armeabi-V7A-机器人-19
  •   
  • 机器人-18
  •   
  • SYS-IMG-armeabi-V7A-机器人-18
  •   
  • 机器人-17
  •   
  • SYS-IMG-armeabi-V7A-机器人-17
  •   
  • 机器人-16
  •   
  • SYS-IMG-armeabi-V7A-机器人-16
  •   
  • 机器人-15
  •   
  • SYS-IMG-armeabi-V7A-机器人-15
  •   
  • 机器人-10
  •   
  • 额外机器人支撑
  •   
  • 外谷歌-google_play_services
  •   
  • 外谷歌-m2repository
  •   
  • 额外的Android-m2repository
  •   

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

答案 2 :(得分:1)

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