Android RoomDatabase - 无法解析 android.arch.persistence.room :compiler:1. 0.0

标签 android gradle

Error:Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.

Could not resolve android.arch.persistence.room:compiler:1.0.0. Required by: project :app

No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.
No cached version of android.arch.persistence.room:compiler:1.0.0 available for offline mode.

房间gradle依赖

implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"

离线模式和构建缓存被禁用。 Gradle 版本 4.1 Gradle项目文件

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.1'
    }
}

最佳答案

Could not resolve android.arch.persistence.room:compiler:1.0.0

要将它添加到您的项目中,请为您的项目打开 build.gradle 文件 (Project Level) 并添加突出显示的行,如下所示:

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

演示

// Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {

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

        }
    }

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

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

请阅读Adding Components to your Project

关于Android RoomDatabase - 无法解析 android.arch.persistence.room :compiler:1. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48341513/

相关文章:

java - 激活 Gitlab 以构建项目并运行测试的 .gitlab-ci.yml 文件应该是什么?

android.provider.Telephony.SMS_RECEIVED 不可用

xml - jetty 配置:dtd问题

android - 在 Android 中构建多项目有什么好处?

gradle - Gradle-每个的命令行

android - 如何将托管在 github 上的项目添加到 android studio gradle 依赖项? Pom.xml 可用

Android多个屏幕尺寸具有相同的密度

java - Android MediaPlayer 在 Android 6.0 Marshmallow 上崩溃

android - 在android中滑动

android - 为什么我在使用 Android v 17 时使用 support.v4 包?