Fixed
Status Update
Comments
sm...@google.com <sm...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 66494e2d6810347e6a3b41ec3f2665e598f108f0
Author: Ian Lake <ilake@google.com>
Date: Thu Apr 14 00:14:24 2022
Ensure that SavedStateHandle restores upon initial creation
runOnNextRecreation() only runs on the next time
the lifecycle reaches CREATED, not the first time.
By using a LifecycleObserver directly, we ensure that
each Lifecycle move causes a performRestore() to
consistently happen.
Test: existing tests pass, sample app works
BUG: 228865698
Relnote: "Fixed an issue where nesting one `NavHost` within
another `NavHost` in a non-primary bottom navigation tab
would lead to an `IllegalStateException` when using
multiple back stacks."
Change-Id: I11bd5173f035ae1da7922b4142fcedc0f3b54ff6
M lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateHandleSupport.kt
https://android-review.googlesource.com/2064518
Branch: androidx-main
commit 66494e2d6810347e6a3b41ec3f2665e598f108f0
Author: Ian Lake <ilake@google.com>
Date: Thu Apr 14 00:14:24 2022
Ensure that SavedStateHandle restores upon initial creation
runOnNextRecreation() only runs on the next time
the lifecycle reaches CREATED, not the first time.
By using a LifecycleObserver directly, we ensure that
each Lifecycle move causes a performRestore() to
consistently happen.
Test: existing tests pass, sample app works
BUG: 228865698
Relnote: "Fixed an issue where nesting one `NavHost` within
another `NavHost` in a non-primary bottom navigation tab
would lead to an `IllegalStateException` when using
multiple back stacks."
Change-Id: I11bd5173f035ae1da7922b4142fcedc0f3b54ff6
M lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateHandleSupport.kt
ap...@google.com <ap...@google.com> #3
Thanks for quick fix! Works well with latest snapshot.
je...@gmail.com <je...@gmail.com> #4
Thanks for confirming! The fix will be in the next release of Lifecycle (2.5.0-beta01).
je...@gmail.com <je...@gmail.com> #5
2.4.1 also has same issue
using jetpack compose / bottom navigation with NavHost
Fatal Exception: java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
at androidx.navigation.NavBackStackEntry.getViewModelStore(NavBackStackEntry.kt:192)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:106)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:69)
using jetpack compose / bottom navigation with NavHost
Fatal Exception: java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
at androidx.navigation.NavBackStackEntry.getViewModelStore(NavBackStackEntry.kt:192)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:106)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:69)
ap...@google.com <ap...@google.com> #6
I am seeing a high occurance rate with 2.5.0-beta01 as well.
sm...@google.com <sm...@google.com> #7
Re remember
around getBackStackEntry
needs to be updated.
sm...@google.com <sm...@google.com> #8
Hi, I recently came across this crash in my current project and I discovered that it happens when a Textfield was tapped and in focus, then the app was backgrounded. This would occur with all of the Textfields in the app.
We are using Compose version: 1.2.0-rc03
and jetpack lifecycle version: 2.4.1
Fatal Exception: java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
at androidx.navigation.NavBackStackEntry.getViewModelStore(NavBackStackEntry.kt:192)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:106)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:69)
We are using Compose version: 1.2.0-rc03
and jetpack lifecycle version: 2.4.1
Fatal Exception: java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
at androidx.navigation.NavBackStackEntry.getViewModelStore(NavBackStackEntry.kt:192)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:106)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:69)
sh...@google.com <sh...@google.com>
al...@gmail.com <al...@gmail.com> #9
Please file a new bug with a minimal sample project that reproduces your error.
sm...@google.com <sm...@google.com> #10
Okay, we will get a sample project up soon. One thing I forgot to mention in the initial comment is that this crash occurs when we use backQueue.clear() to clear the back stack. We were able to come up with a solution/workaround by using popUpTo() as a way to clear the back stack, and after implementing that solution we saw no crashes when backgrounding the app while a textfield was in focus.
Description
Fatal Exception: java.lang.IllegalStateException: Range start point not set.
at androidx.core.util.Preconditions.checkState(SourceFile:96)
at androidx.recyclerview.selection.DefaultSelectionTracker.extendProvisionalRange(SourceFile:281)
at androidx.recyclerview.selection.GestureSelectionHelper.extendSelection(SourceFile:227)
at androidx.recyclerview.selection.GestureSelectionHelper.handleMoveEvent(SourceFile:204)
at androidx.recyclerview.selection.GestureSelectionHelper.handleTouch(SourceFile:151)
at androidx.recyclerview.selection.GestureSelectionHelper.onTouchEvent(SourceFile:125)
at androidx.recyclerview.selection.TouchEventRouter.onTouchEvent(SourceFile:103)
at androidx.recyclerview.widget.RecyclerView.dispatchToOnItemTouchListeners(SourceFile:3035)
at android.view.View.dispatchTouchEvent(View.java:10775)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2859)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2535)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:568)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1896)
at android.app.Activity.dispatchTouchEvent(Activity.java:3247)
at com.supercilex.robotscouter.core.ui.ActivityBase.dispatchTouchEvent(SourceFile:82)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(SourceFile:69)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(SourceFile:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:530)
at android.view.View.dispatchPointerEvent(View.java:11004)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5111)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4963)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4494)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4547)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4513)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4646)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4521)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4703)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4494)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4547)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4513)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4521)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4494)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7003)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6934)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6895)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7113)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7077)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7140)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:632)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6836)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)