How do i fix this error "Could not find android.room:room-compiler:2.2.4."

Viewed 4929

I am working on a test project in Kotlin that uses the MVVM architecture with room. after adding dependencies and libraries for the project the project builds successfully, but when i try running the application it shows this error:

Could not find android.room:room-compiler:2.2.4.

Searched in the following locations:

This my build.gradle app level:

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"

}

This my project level build.gradle file:

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
}
3 Answers

It is androidx.room, not android.room, also, it is room-compiler not room-complier (not the placement of the i):

kapt "androidx.room:room-compiler:2.2.4"

If your error is: How do i fix this error “Could not find android.room:room-complier:2.2.5” You can downgrade Room into 2.2.4 and resolve it.

Guys in my case i am getting this error because of INVALID RAW Query.

Please check your query.

Related