google-developer-training / android-basics-kotlin-cupcake-app

Apache License 2.0
103 stars 163 forks source link

Android Basics: Shared ViewModel #98

Closed sinkec closed 8 months ago

sinkec commented 1 year ago

URL of codelab

In which task and step of the codelab can this issue be found?

5

Describe the problem

i get error in onCreateView

val mainViewModel = MainActivityViewModel by activityViewModels()

does not have a companion object, and thus must be initialized here

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions Android Studio version: API version of the emulator:

Additional information Include screenshots if they would be useful in clarifying the problem.