Cannot create an instance of class ViewModel kotlin

前端 未结 7 1843
礼貌的吻别
礼貌的吻别 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 was added private set in DatabaseClass :| I removed it.

      private var INSTANCE: NoteDatabase? = null
                private set
    

    to :

    private var INSTANCE: NoteDatabase? = null
    

    this problem take my 2 hours :|||

提交回复
热议问题