添加 Android 房间库(jcenter 给出 404 错误)

Adding Android Room library (jcenter gives 404 error)

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

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

构建文件(项目):

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' }
    }
}