如何修复此错误"Could not find android.room:room-compiler:2.2.4."



我正在Kotlin进行一个测试项目,该项目使用带空间的MVVM架构。在为项目添加依赖项和库后,项目成功构建,但当我尝试运行应用程序时,它显示了以下错误:

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

在以下位置搜索:

  • https://dl.google.com/dl/android/maven2/android/room/room-complier/2.2.4/room-complier-2.2.4.pom
  • https://dl.google.com/dl/android/maven2/android/room/room-complier/2.2.4/room-complier-2.2.4.jar
  • https://jcenter.bintray.com/android/room/room-complier/2.2.4/room-complier-2.2.4.pom
  • https://jcenter.bintray.com/android/room/room-complier/2.2.4/room-complier-2.2.4.jar
  • https://jitpack.io/android/room/room-complier/2.2.4/room-complier-2.2.4.pom
  • https://jitpack.io/android/room/room-complier/2.2.4/room-complier-2.2.4.jar要求:项目:应用

这是我的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"
}

这是我的项目级build.gradle文件:

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-compiler,不是room-complier(不是i的位置(:

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

如果您的错误是:我如何修复这个错误"找不到android。房间:房间编译器:2.2.5"您可以将Room降级为2.2.4并进行解析

伙计们,在我的情况下,我收到这个错误是因为无效的RAW查询。

请检查您的查询。

最新更新