【问题标题】:Travis CI for Android - Build Error: Failed to find target & Could not find dependenciesTravis CI for Android - 构建错误:无法找到目标和找不到依赖项
【发布时间】:2015-06-09 10:51:25
【问题描述】:

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

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

谢谢!

【问题讨论】:

标签: android android-gradle-plugin travis-ci


【解决方案1】:

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

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

【讨论】:

  • 它对我有用,谢谢!但后来我得到了新的错误:找不到找不到 com.android.support:support-v4:22.2.0 com.google.android.gms:play-services:7.3.0.. 有什么建议吗?
  • 尝试添加-extra-android-support
  • 试过了,但没有运气。似乎默认情况下已经包含了额外的安卓支持。您在项目中使用的是哪个支持库版本?
  • @Liuting 我已经提交了一个pull request来修复它,请合并(github.com/evercam/evercam-play-android/pull/36)
  • 为 gradle 添加 -extra-android-m2repository 和 -extra-google-m2repository。
【解决方案2】:

也有可能 Travis 尚未使用适当的 sdks 进行更新。来自their docs(截至 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
  • 额外的安卓支持
  • 额外的google-google_play_services
  • 额外的 google-m2 存储库
  • 额外的android-m2repository

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

【讨论】:

【解决方案3】:
language: android
    android:
      components:
        - platform-tool
        - tool
        - android-22
        - build-tools-22.0.1
        - extra-android-m2repository
        - extra-google-m2repository

【讨论】:

    猜你喜欢
    • 2012-11-09
    • 2016-12-16
    • 1970-01-01
    • 1970-01-01
    • 2016-07-11
    • 1970-01-01
    • 2016-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多