你好,在添加了Room依赖项并更改Kotlin版本后,我遇到了一个错误,似乎无法解决这个问题。
错误:
/Users/Erin/.gradle/caches/transforms-3/c3d04919ade1d841f45db1aa77dde355/transformed/room-runtime-2.4.3-api.jar!/META-INF/room-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
build.gradle(:app)
dependencies{
def room_version = "2.4.3"
//room dependencies
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor("androidx.room:room-compiler:$room_version")
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$room_version")
implementation("androidx.room:room-ktx:$room_version")
}
Build.gradle(:项目)
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
dependencies {
classpath("com.google.dagger:hilt-android-gradle-plugin:2.42")
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
发布于 2022-08-31 11:50:04
将Kotlin版本更新为1.6.10
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
https://stackoverflow.com/questions/73543818
复制相似问题