gpt4 book ai didi

android - 添加Android Room库(jcenter给出404错误)

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

我正在尝试将android Room库添加到我的项目中,但我做不到。

我按照开发站点上的说明进行操作,但是没有用。

生成文件(项目):

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}

allprojects {
repositories {
jcenter()
google()
}
}

生成文件(应用程序):
dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:25.3.1'
implementation 'com.android.support:design:25.3.1'

def room_version = "1.1.0"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
implementation "android.arch.persistence.room:guava:$room_version"
testImplementation "android.arch.persistence.room:testing:$room_version"}

然后当我同步我的项目时。

我看到以下错误:
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.1.0.
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.persistence.room:rxjava2:1.1.0.
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.persistence.room:guava:1.1.0.
Failed to resolve: android.arch.persistence.room:rxjava2:1.1.0
Failed to resolve: android.arch.persistence.room:guava:1.1.0
Failed to resolve: android.arch.persistence.room:runtime:1.1.0

当我检查jcenter.bintray.com时出现404错误。
我该怎么办?

谢谢

最佳答案

尝试将maven { url 'https://maven.google.com' }添加到build.gradle文件(项目)中的存储库列表中:

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

关于android - 添加Android Room库(jcenter给出404错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51350092/

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