Status Update
Comments
ol...@sbab.se <ol...@sbab.se> #2
We are also seeing this issue, affects users in production. Is there a workaround for this?
Other than downgrading to jetpack navigation 2.7 where we don't see this issue (as suggested by someone here:
bn...@gmail.com <bn...@gmail.com> #3
I can see the exact same issue, when turning off predictive navigation support in the app, instead of crashing, the component is launching from the wrong place.
When crashing, the stacktrace:
java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.util.Objects.checkIndex(Objects.java:359)
at java.util.ArrayList.get(ArrayList.java:434)
at androidx.navigation.compose.NavHostKt$NavHost$28$1.invokeSuspend(NavHost.kt:611)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:9063)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@af66c29, androidx.compose.runtime.BroadcastFrameClock@96bbae, StandaloneCoroutine{Cancelling}@3f11d4f, AndroidUiDispatcher@eb1bcdc]
After reverting to 2.7 the issue seems resolved, but this version doesn't support predictive back gestures, and the animation system is different too.
It sadly still isn't fixed in 2.9.0-alpha03.
zt...@gmail.com <zt...@gmail.com> #4
I seen this issues
if (inPredictiveBack) {
LaunchedEffect(progress) {
// This happens in the following line of code
val previousEntry = currentBackStack[currentBackStack.size - 2]
transitionState.seekTo(progress, previousEntry)
}
}
Here is this project:
I guess it's because I used this:
navController.navigate(
Router.QueuePage.route
) {
popUpTo(Router.MainView.route) {
// Inclusive means the start destination is also popped
inclusive = false
}
}
If I use this code, it will quickly come to this problem.
navController.navigate(Router.QueuePage.route) {
popUpTo(Router.QueuePage.route) {
inclusive = true
}
launchSingleTop = true
}
fr...@gmail.com <fr...@gmail.com> #5
I confirm the problem on Samsung S22 14 Android. Any news on its solution?
Description
Component used: Navigation Compose Version used: 2.8.3 Devices/Android versions reproduced on: Samsung A15, Android 14
Sometimes the app crashes on back navigation with the following stacktrace:
The culprit seems to be in this block in NavHost.kt at line 611:
It's hard to reproduce it reliably, because we have a quick transition between screens on app start, but it seems that in order to trigger this crash, one need to quickly press back button (or activate back gesture, most likely) with predictive back navigation enabled for the app.