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

Apache License 2.0
103 stars 163 forks source link

Android Basics: Shared ViewModel #34

Closed ghost closed 10 months ago

ghost commented 3 years ago

URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-training-shared-viewmodel?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-4%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-shared-viewmodel#6

In which task and step of the codelab can this issue be found? Shared ViewModel Across Fragments Task 7 step 8.

Describe the problem The step says to: Remove the initial values from the declaration of the properties in the class. Now you are using the init block to initialize the properties when an instance of OrderViewModel is created.

Which results in several errors: Unresolved reference, and Variable Expected

Steps to reproduce?

  1. Go to follow the steps of the tutorial and you get those errors
  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.