概要
KotlinのプロジェクトでRoomを使うと
こんな感じのエラーが出てきました。
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution > java.lang.reflect.InvocationTargetException (no error message)
M1Mac環境で出るエラーのようですが、stackoverflowを参考にして解決する事が出来ました。
本文
build.gradle(:app)
dependencies {
// Room components
implementation "androidx.room:room-runtime:2.3.0"
kapt "androidx.room:room-compiler:2.3.0"
implementation "androidx.room:room-ktx:2.3.0"
androidTestImplementation "androidx.room:room-testing:2.3.0"
}
この記事を書いている時点のバージョン(2.3.0)だとエラーが出ましたが、バージョン2.2.4(もしくは2.2.5)に下げるとエラーが出なくなります。
dependencies {
// Room components
implementation "androidx.room:room-runtime:2.2.4"
kapt "androidx.room:room-compiler:2.2.4"
implementation "androidx.room:room-ktx:2.2.4"
androidTestImplementation "androidx.room:room-testing:2.2.4"
}
補足
そのうち改善されると思いますので、最新バージョンでエラーが出ていない方は最新バージョンをお使いください