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

Apache License 2.0
89 stars 256 forks source link

Android Basics: ViewModel #201

Closed Soulmeister-x closed 8 months ago

Soulmeister-x commented 1 year ago

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

In which task and step of the codelab can this issue be found? Understand ViewModel lifecycle Step 3.: Add a log statement inside onCleared() to track the GameViewModel lifecycle.

Describe the problem I added the log statement as expected and tested it on an emulator with API level 31 (Nexus 5). I realized that the log message is never displayed in Logcat. I trust in Logcat and the Log library's functionality, so I searched "gameviewmodel oncleared is not called", which led me to this issue: https://github.com/android/architecture-components-samples/issues/337

Steps to reproduce?

  1. Go to... https://github.com/Soulmeister-x/android-basics-kotlin-unscramble-app/tree/starter
  2. Click on... Run
  3. See error... Logcat > TAG="GameFragment"

Versions Android Studio version: 4.3.1 API version of the emulator: 31

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

android-dev-lxl commented 1 year ago

Duplicate of #193