添加注释处理器“ android.arch.persistence.room:compiler:1.1.1”时出现匕首问题

时间:2018-12-13 12:40:42

标签: android dagger-2 android-room android-architecture-components android-livedata

我一直在应用程序中使用dagger2。我已经开始将Room集成到我的项目中。当我在build.gradle中添加 annotationProcessor“ android.arch.persistence.room:compiler:1.1.1” 并运行代码后,我开始出现匕首问题,例如:错误: (10,27)错误:找不到符号类DaggerDiComponent

当我从gradle中注释/删除annotationProcessor行时,项目会构建,但不会生成明显的db类。有人可以帮我吗?

我模块的build.gradle的受限版本是

    //dagger
    implementation 'com.google.dagger:dagger:2.0'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.0'

    // Room components
    implementation "android.arch.persistence.room:runtime:1.1.1"
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
    androidTestImplementation "android.arch.persistence.room:testing:1.1.1"

    // Lifecycle components
    api "android.arch.lifecycle:extensions:1.1.1"
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"

还有许多其他库文件,但不包括出于简化目的的文件。我的应用程序的build.gradle是

buildscript {
    repositories {
        google()
        jcenter()
        flatDir { dirs 'proguard' }
        mavenCentral()
        flatDir { dirs 'proguard' }
        maven { url 'https://jitpack.io' }
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.3'

        classpath "com.newrelic.agent.android:agent-gradle-plugin:5.18.1"
        classpath 'proguard.io:proguard:5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

感谢您的帮助

0 个答案:

没有答案