android – Gradle自定义存储库和依赖项解析

前端之家收集整理的这篇文章主要介绍了android – Gradle自定义存储库和依赖项解析前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开发的项目需要 scribe-javacrashlytics库.这两个库都可以从自定义存储库中获得.

build.gradle看起来像:

buildscript {
    repositories {
        maven { url 'http://download.crashlytics.com/maven' }
    }

    dependencies {
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
    // is required by Crashlytics library
    maven { url 'http://download.crashlytics.com/maven' }
    // is required by Scribe library
    maven { url 'https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/' }
}

....

dependencies {

    compile 'com.android.support:support-v4:+'

    compile 'com.crashlytics.android:crashlytics:1.+'
    ...
    // OAuth/OAuth2
    compile 'org.scribe:scribe:1.3.6'
    ...
}

使用这样的设置存储库解决方案在构建过程中变得混乱,以至于gradle尝试从不适当的存储库中解析工件:

Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/crashlytics/android/crashlytics/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/nineoldandroids/library/]
Resource missing. [HTTP GET: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/maven-Metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/com/android/support/appcompat-v7/]

它试图从scribe存储库中检索crashlytics文件.

解决方法

按声明的顺序搜索存储库,直到找到依赖关系.如果在scribe存储库中搜索crashlytics库,则意味着在crashlytics存储库中找不到它.
原文链接:https://www.f2er.com/android/317727.html

猜你在找的Android相关文章