【发布时间】:2021-12-30 03:14:54
【问题描述】:
在运行我的应用程序时,我收到此错误(以及其他 6 个类似错误),将我的代码中的房间版本更改为 2.3.0 或 2.2.3 并不能修复它。
1: 任务因异常而失败。
- 出了什么问题: 任务“:app:checkDebugAarMetadata”执行失败。
无法解析配置“:app:debugRuntimeClasspath”的所有文件。 找不到 androidx.room:room-coroutines:2.4.0。 在以下位置搜索: - https://dl.google.com/dl/android/maven2/androidx/room/room-coroutines/2.4.0/room-coroutines-2.4.0.pom - https://repo.maven.apache.org/maven2/androidx/room/room-coroutines/2.4.0/room-coroutines-2.4.0.pom - https://jcenter.bintray.com/androidx/room/room-coroutines/2.4.0/room-coroutines-2.4.0.pom 要求: 项目:应用程序
- 试试:
使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。 运行 --scan 以获得完整的见解。
这是我的项目 Build.Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
activityVersion = '1.4.0'
appCompatVersion = '1.4.0'
constraintLayoutVersion = '2.1.2'
coreTestingVersion = '2.1.0'
coroutines = '1.5.2'
lifecycleVersion = '2.4.0'
materialVersion = '1.4.0'
roomVersion = '2.4.0'
// testing
junitVersion = '4.13.2'
espressoVersion = '3.4.0'
androidxJunitVersion = '1.1.3'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的应用 Build.Gradle:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.burnouttracker"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
implementation "androidx.activity:activity-ktx:$rootProject.activityVersion"
// Dependencies for working with Architecture components
// You'll probably have to update the version numbers in build.gradle (Project)
// Room components
//implementation "androidx.room:room-ktx:$rootProject.roomVersion"
implementation("androidx.room:room-runtime:$rootProject.roomVersion")
kapt "androidx.room:room-compiler:$rootProject.roomVersion"
androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
//I added this one
implementation "androidx.room:room-coroutines:$rootProject.roomVersion"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$rootProject.lifecycleVersion"
// Kotlin components
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"
// UI
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"
implementation "com.google.android.material:material:$rootProject.materialVersion"
// Testing
testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
androidTestImplementation ("androidx.test.espresso:espresso-core:$rootProject.espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation "androidx.test.ext:junit:$rootProject.androidxJunitVersion"
//implementation 'androidx.core:core-ktx:1.7.0'
//implementation 'androidx.appcompat:appcompat:1.4.0'
//implementation 'com.google.android.material:material:1.4.0'
//implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
//testImplementation 'junit:junit:'
//androidTestImplementation 'androidx.test.ext:junit:1.1.3'
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
【问题讨论】:
标签: android-studio kotlin android-room