gpt4 book ai didi

Android Gradle 依赖解析顺序

转载 作者:行者123 更新时间:2023-12-03 05:16:53 27 4
gpt4 key购买 nike

我的应用程序模块的 build.gradle 文件中有一个远程 maven 存储库。当我从命令行运行 assembleDebug -info 时,我可以看到 gradle 正在尝试通过在我的远程 maven 存储库中查找支持库依赖项来解决它们,并且我收到此错误:

    Resource missing. [HTTP GET: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/appcompat-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/cardview-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/cardview-v7/]
Resource missing. [HTTP GET: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/palette-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/palette-v7/]
Resource missing. [HTTP GET: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/recyclerview-v7/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.githubusercontent.com/me/releases-android/master/releases/com/android/support/recyclerview-v7/]
Resource missing. [HTTP GET: https://raw.githubusercontent.com/me/releases-android/master/releases/com/google/android/gms/play-services/maven-metadata.xml]
Failed to get resource: GET. [HTTP HTTP/1.1 400 Bad Request: https://raw.githubusercontent.com/me/releases-android/master/releases/com/google/android/gms/play-services/]

问题:有没有办法配置 gradle 文件以停止尝试连接到我的远程 maven repo 以解决 android 特定的依赖项?这是我的 build.gradle 文件:
apply plugin: 'com.android.application'

android {
...

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:palette-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:support-v13:21.0.0'
}
}

repositories {
//My personal repo
maven { url 'https://raw.githubusercontent.com/me/releases-android/master/releases/'}
}

dependencies {
//My App's Dependencies here
}

最佳答案

不要使用 +在您的版本号中。如果您使用 + ,那么构建系统需要定期检查是否有更新的版本可用。如果您指定显式版本号而没有 + ,并且如果该版本被缓存,它将永远不必为它访问网络。

它正在查看您的自定义存储库,因为要评估 +版本规范,它将需要扫描所有存储库以找到具有最新版本的存储库。如果您明确指定版本号,它将按照存储库在构建文件中出现的顺序扫描存储库,并在获得所需内容时停止。

关于Android Gradle 依赖解析顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26473929/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com