Android支持存储库和持续集成

时间:2015-06-15 17:18:13

标签: android jenkins gradle android-appcompat

我目前正在将我的项目迁移到Gradle,这个带有多个分支的项目目前正由Jenkins构建。

在Android Studio中构建应用程序之后,我已经推动了我的提交并遇到了一些障碍:Jenkins似乎并不了解在哪里可以找到支持库。

A problem occurred configuring root project 'Android_Alpha_Gradle'.
A problem occurred configuring project ':HereAndNowAPI'.
Could not resolve all dependencies for configuration ':HereAndNowAPI:_debugCompile'.


 Could not find com.android.support:appcompat-v7:19.0.0.
    Searched in the following locations:

        https://repo1.maven.org/maven2/com/android/support/appcompat-v7/19.0.0/appcompat-v7-19.0.0.pom
        https://repo1.maven.org/maven2/com/android/support/appcompat-v7/19.0.0/appcompat-v7-19.0.0.jar
        https://jcenter.bintray.com/com/android/support/appcompat-v7/19.0.0/appcompat-v7-19.0.0.pom
        https://jcenter.bintray.com/com/android/support/appcompat-v7/19.0.0/appcompat-v7-19.0.0.jar

    Required by:
        Android_Alpha_Gradle:HereAndNowAPI:unspecified

 Could not find com.android.support:support-v4:22.2.0.
    Searched in the following locations:

        https://repo1.maven.org/maven2/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
        https://repo1.maven.org/maven2/com/android/support/support-v4/22.2.0/support-v4-22.2.0.jar
        https://jcenter.bintray.com/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom
        https://jcenter.bintray.com/com/android/support/support-v4/22.2.0/support-v4-22.2.0.jar

    Required by:
        Android_Alpha_Gradle:HereAndNowAPI:unspecified

显然这台机器是无头的,我不确定如何通过命令行安装Android Support Repository。有什么想法吗?

2 个答案:

答案 0 :(得分:6)

使用这个非常棒的SDK Manager插件

https://github.com/JakeWharton/sdk-manager-plugin

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.3'
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
    }
}

apply plugin: 'android-sdk-manager'

答案 1 :(得分:2)

显然谷歌决定不发布到JCenter或MavenCentral。你必须使用extra-android-m2repository运行android sdk update。 Jake Wharotn的SDK Manager插件为您处理此下载。