【问题标题】:Android O Gradle build fails with travis ciAndroid O Gradle 构建因 travis ci 失败
【发布时间】:2017-06-07 07:49:55
【问题描述】:

我正在尝试将 Travis CI 用于我的 Android 项目,但我的构建经常失败,但可以在本地构建上运行。我正在使用 Android Studio Preview 3 和 gradle 3 alpha 3。

我在下面收到此错误。

找不到 com.android.tools.build:gradle:3.0.0-alpha3。

这是我的构建 log

我的 Travis 配置file

我的项目毕业file

【问题讨论】:

    标签: android travis-ci


    【解决方案1】:

    您的构建log 收到拒绝访问错误,我没有使用它,但我会尽力回答您。

    正如here宣布的那样:

    Android Gradle Plugin 3.0.0-alpha3 也通过 maven.google.com。

    您可以尝试通过添加 Google 的 Maven 存储库 here 来修复它,例如 this

    buildscript {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    

    确保 repositories 部分包含一个 maven 部分 “https://maven.google.com”端点。例如:

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

    正如here 所评论的,Bintray JCenter 中不存在此版本:

    com.android.tools.build.gradle 最新版本是2.5.0-alpha-preview-02,没有3.0.0-alpha3

    还要确保按照this related question 中的建议将构建工具更新到最新版本:

    从 SDK 管理器更新您的构建工具

    我使用新的sdkmanager 命令行here 添加指向示例的链接。

    我需要一个重现该问题的示例项目来检查我的建议。

    【讨论】:

    • 我还需要在构建脚本中添加 google 的 maven 存储库,因为我已经在 allprojects 中添加了它
    • 我添加了一个解释here,但它已经回答了here
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-08
    • 2021-04-01
    • 2019-11-02
    相关资源
    最近更新 更多