Status Update
Comments
jb...@google.com <jb...@google.com> #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:
[Deleted User] <[Deleted User]> #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.
[Deleted User] <[Deleted User]> #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
}
jb...@google.com <jb...@google.com> #5
I confirm the problem on Samsung S22 14 Android. Any news on its solution?
[Deleted User] <[Deleted User]> #6
I have created a sample project which reproduces the issue, and attached a video.
When enableOnBackInvokedCallback
is enabled in manifest, the pop exiting destination is incorrectly drawn underneath the pop entering destination. When it is disabled, everything works as expected (but no predictive back)
Description
Component used: Navigation Version used: 2.8.0-alpha04 Devices/Android versions reproduced on:
The goal is to make sure that the incoming screen appears from behind the current screen (instead of on top of the current screen as shown in the video) when implementing predictive back animation.
The following is the configuration used to produce the attached video. Couldn't find transition that deals with zIndex.