I'm trying to use Room. I get this error (in runtime):
java.lang.RuntimeException: cannot find implementation for com.easythings.booky.database.BookyDatabase. BookyDatabase_Impl does not exist
My BookyDatabase class:
@Database(entities = [Book::class, Chapter::class], version = 1)
abstract class BookyDatabase : RoomDatabase() {
abstract val bookDao: BookDao
abstract val chapterDao: ChapterDao
companion object {
@Volatile
private var _databaseInstance: BookyDatabase? = null
fun getDatabase(context: Context): BookyDatabase {
if (_databaseInstance == null)
synchronized(BookyDatabase::class.java) {
if (_databaseInstance == null)
_databaseInstance = Room.databaseBuilder(
context.applicationContext,
BookyDatabase::class.java,
"booky_database"
)
.fallbackToDestructiveMigration()
.build()
}
return _databaseInstance!!
}
}
}
I don't understand what is wrong.
The BookyDatabase_Impl
most likely isn't being generated ...
a) because you lack the annotations.
b) because you lack an annotation processor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.