Cannot create an instance of class ViewModel kotlin

前端 未结 7 1837
礼貌的吻别
礼貌的吻别 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:40

    In my case this implementation solved my problem

    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"

    before I implemented this only implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"

提交回复
热议问题