1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Kotlin]Roomデータベースを使う時に出るエラーの対処法(M1 Mac環境)

Last updated at Posted at 2021-11-03

概要

KotlinのプロジェクトでRoomを使うと
スクリーンショット 2021-11-03 16.24.17.png
こんな感じのエラーが出てきました。

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"
}

補足

そのうち改善されると思いますので、最新バージョンでエラーが出ていない方は最新バージョンをお使いください:balloon:

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?