According to Listing 4.3 I added the line:
private val quizViewModel: QuizViewModel by viewModels()
but QuizViewModel is coloured red, and show the msg: “unresolved reference”.
Furthermore viewModels() is underlined.
I made the ViewModel class according to Listing 4.2 and I added the depencies as shown in listing 4.1
Also I added “import androidx.activity.viewModels” in the MainActivity.kt file.
I am using Android Studio Hedgehog.
What can be wrong ?