Property delegate must have a 'getValue(MainActivity, KProperty<*>)' method

Viewed 811

while reading the book "Android programming the big nerd ranch guide 4th edition", I ran into the problem that when using lazy, the error: Property delegate must have a 'getValue(MainActivity, KProperty<*>)' method. None of the following functions is suitable: public inline operator fun <T> Lazy<QuizViewModel>.getValue(thisRef: Any?, property: KProperty<*>): QuizViewModel defined in kotlin.

private val quizViewModel: QuizViewModel by lazy {
    ViewModelProvider.(this).get(QuizViewModel::class.java)
}

english is not my native language and this is my first question on stackoverflow, so I'm sorry for the mistakes

0 Answers
Related