Fixed
Status Update
Comments
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
ap...@google.com <ap...@google.com> #3
yea i'll take it.
jb...@google.com <jb...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
Description
Component used: "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.lifecycle" Version used: '2.2.0' Devices/Android versions reproduced on:
Name: Pixel_3_API_29
CPU/ABI: Google Play Intel Atom (x86)
Path: /Users/jingtang/.android/avd/Pixel_3_API_29.avd
Target: google_apis_playstore [Google Play] (API level 29)
Skin: pixel_3
SD Card: 512M
If this is a bug in the library, we would appreciate if you could attach:
This code is fine:
class QuestionnaireViewModel(application: Application, private val state: SavedStateHandle) : AndroidViewModel(application) {
But this code:
class QuestionnaireViewModel(private val state: SavedStateHandle, application: Application) : AndroidViewModel(application) {
Causes this error:
Caused by: java.lang.NoSuchMethodException: com.google.android.fhir.datacapture.gallery.QuestionnaireViewModel.<init> [class android.app.Application] at java.lang.Class.getConstructor0(Class.java:2332) at java.lang.Class.getConstructor(Class.java:1728) at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.java:267) at androidx.lifecycle.SavedStateViewModelFactory.create(SavedStateViewModelFactory.java:112) at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:185) at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:150) at androidx.lifecycle.ViewModelLazy.getValue(ViewModelProvider.kt:54) at androidx.lifecycle.ViewModelLazy.getValue(ViewModelProvider.kt:41) at com.google.android.fhir.datacapture.gallery.QuestionnaireActivity.getViewModel(Unknown Source:2) at com.google.android.fhir.datacapture.gallery.QuestionnaireActivity.onCreate(QuestionnaireActivity.kt:42) at android.app.Activity.performCreate(Activity.java:7802) at android.app.Activity.performCreate(Activity.java:7791) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)