I am trying to write a simple app using Kotlin and Room Persistence Library. I followed the tutorial in the Android Persistence codelab.
Here is my AppDatabase<
Try out these steps
Step 1. Set the room_version in the project.gradle file
buildscript {
ext.kotlin_version = '1.1.51'
ext.room_version = '1.0.0-alpha9-1'
...
Step 2. Apply the kotlin-kapt plugin in the app.gradle file, and this solved my issue.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
...
Step 3. Add the kapt dependency in the app.gradle file
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
kapt "android.arch.persistence.room:compiler:$room_version"
...
}