如何修复此错误;找不到android。文件室:文件室编译器:2.2.4。”;

如何修复此错误;找不到android。文件室:文件室编译器:2.2.4。”;,android,kotlin,mvvm,Android,Kotlin,Mvvm,我正在Kotlin进行一个测试项目,该项目使用Mvvm架构和room。 在为项目添加依赖项和库之后,项目成功构建,但是当我尝试运行应用程序时,它显示了此错误 找不到android。文件室:文件室编译器:2.2.4。 在以下位置搜索: - - - - - - 要求: 项目:应用程序 这是我的build.gradle应用程序级别 apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply p

我正在Kotlin进行一个测试项目,该项目使用Mvvm架构和room。 在为项目添加依赖项和库之后,项目成功构建,但是当我尝试运行应用程序时,它显示了此错误

找不到android。文件室:文件室编译器:2.2.4。 在以下位置搜索: - - - - - - 要求: 项目:应用程序

这是我的build.gradle应用程序级别

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

//kotlin Kapt and navigation safeargs plugin
apply plugin: 'kotlin-kapt'

apply plugin: "androidx.navigation.safeargs"

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.cruxrepublic.mvvmapplication"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


//    Retrofit and Gson
    implementation 'com.squareup.retrofit2:retrofit:2.7.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.0'

//    kotlin Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.1"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1"
//    ViewModel and LiveData
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"

//    New Material Design
    implementation 'com.google.android.material:material:1.2.0-alpha03'

//    Kodein Dependency Injection
    implementation "org.kodein.di:kodein-di-generic-jvm:6.2.1"
    implementation "org.kodein.di:kodein-di-framework-android-x:6.2.1"

//    Android Room
    implementation "androidx.room:room-runtime:2.2.4"
    implementation "androidx.room:room-ktx:2.2.4"
    kapt "android.room:room-complier:2.2.4"
//    kapt 'androidx.room:room-compiler:2.1.0-alpha04'

//    Android Navigation Architecture
    implementation "androidx.navigation:navigation-fragment-ktx:2.2.0-rc04"
    implementation "androidx.navigation:navigation-ui-ktx:2.2.0-rc04"

}
此mu项目级build.graddle文件

buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-alpha02"
    }
}

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


    }
}

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

它是
androidx.room
,不是
android.room
,也是
room编译器
不是
room编译器
(不是
i
的位置):

如果您的错误是: 如何修复此错误“找不到android.room:room complier:2.2.5”
您可以将
Room
降级为
2.2.4
,并解决它。

各位,在我的情况下,由于原始查询无效,我收到了此错误


请检查您的查询。

我已改为“androidx”,它仍然有相同的错误啊,是的,您拼写错误了
编译器
。我更新了我的答案谢谢你。这几天一直在寻找解决办法。成功了!
kapt "androidx.room:room-compiler:2.2.4"