Cannot create an instance of class ViewModel kotlin

前端 未结 7 1839
礼貌的吻别
礼貌的吻别 2021-01-18 05:39

Here is my code

class BookmarkViewModel(app: Application) : AndroidViewModel(app) {

    private val dao = BookmarkDb.get(app).bookmarkDao()

    companion o         


        
相关标签:
7条回答
  • 2021-01-18 06:46

    In my case, I had forgotten to annotate my DatabaseClass class with

    @Database(entities = [Book::class], version = 1)
    abstract class BookRoomDatabase: RoomDatabase() 
    
    0 讨论(0)
提交回复
热议问题