Status Update
Comments
jo...@meterapp.co <jo...@meterapp.co> #2
I'm also seeing this crash, its the largest crash in my app by far. Thanks for reporting this
jo...@meterapp.co <jo...@meterapp.co> #3
I am on Samsung Galaxy Z Fold 5. Android 14. Very easy to reproduce when I unfold the phone and switch between navigation rail items very quickly. When the phone is folded the error cannot be reproduced (at least for me).
bi...@gmail.com <bi...@gmail.com> #4
98% affected (unique) users are Samsung devices (2% motorola) - from 100 bug occurences over 10k+ users
100% are on Android 14
[Deleted User] <[Deleted User]> #5
In our case, to reproduce the crash, we press simultaneously the Action Bar back arrow (navController::navigateUp) AND the hardware back button.
This way we get the stacktrace:
java.lang.ArrayIndexOutOfBoundsException: length=10; index=-1
at java.util.ArrayList.get(ArrayList.java:439)
at androidx.navigation.compose.NavHostKt$NavHost$25$1.invokeSuspend(NavHost.kt:518)
- navigation-compose 2.8.3
- activity-compose 1.9.3
- Android 12 (API 31)
8h...@gmail.com <8h...@gmail.com> #6
as I understand it doesn't happen with androidxNavigation = "2.7.7"
version or lower, so let's not updated it until it's fixes
jo...@meterapp.co <jo...@meterapp.co> #7
as I understand it doesn't happen with androidxNavigation = "2.7.7" version or lower, so let's not updated it until it's fixes
Yes this is correct, unfortunately I'm past the point of no return because I migrated my app to type safe navigation APIs, it would be very unfortunate to migrate back because this crash is not resolved. Does anyone know why this issue has not been assigned to anyone? It seems like a huge, top voted, issue.
pa...@wewell.app <pa...@wewell.app> #8
I confirm reverting to 2.7.7
fixes the issue. I'm not happy at all with this solution, I had to revert also Compose Destinations and Koin... Could we please get a proper fix?
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #9
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Add conditional check inside NavHost PredictiveBackHandler
Expand for full commit details
Add conditional check inside NavHost PredictiveBackHandler
There is no way to guarantee that we will get a composition if a state
change and back callback get triggered in the same frame. This can
result in triggering the `PredictiveBackHandler`'s callback even though
it should actually be disabled.
The cleaner options of fixing this are to change the
`PredictiveBackHandler`'s `enabled` parameter to a Boolean producing
lambda that can be executed internally and retrieve the current value,
but that needs a new API. (see 379152996#comment2)
In the meantime, we just need to add the same check inside of the
`PredictiveBackHandler`'s lambda.
RelNote: "Fixed an issue where `NavHost` could throw an exception
inside of the `PredictiveBackHandler` if the back stack is popped down
to 1 entry and a system back are triggered in the same frame."
Test: added testDisabledInSameFramePredictiveBack
Bug: 375343407
Change-Id: I1a4297a10f2d0da8c8477644b9250c61e4792923
Files:
- M
navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostPredictiveBackTest.kt
- M
navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
Hash: f724837c72814a08c4177004ae3e8f380eea8367
Date: Fri Nov 15 20:56:54 2024
[Deleted User] <[Deleted User]> #10
jb...@google.com <jb...@google.com> #11
This has ben fixed internally and will be available in the Navigation 2.8.5
release.
jo...@meterapp.co <jo...@meterapp.co> #12
Thank you so much for your hard work and persistence on this issue! Really excited for the 2.8.5 release :)
sh...@navi.com <sh...@navi.com> #13
by when can i expect 2.8.5 to hit stable and be available to use?
jo...@meterapp.co <jo...@meterapp.co> #14
by when can i expect 2.8.5 to hit stable and be available to use?
Based on the androidx release schedule, I'd assume it will be available December 11th. It looks like they skipped the thanksgiving release for most libraries and I'm hoping they'll be back with releases December 11th.
pr...@google.com <pr...@google.com> #15
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.9.0-alpha04
androidx.navigation:navigation-compose:2.8.5
si...@gmail.com <si...@gmail.com> #16
I can confirm that our usual way of reproducing this issue with the debugger no longer crashes. Thanks a lot for this release!
sa...@gmail.com <sa...@gmail.com> #17
ma...@wm.rs <ma...@wm.rs> #18
Hi, I'm still facing the issue with 2.8.5
The stack trace:
Fatal Exception: 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:620)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
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(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
It's seems the issue now is in val previousEntry = currentBackStack[currentBackStack.size - 2]
:
if (inPredictiveBack) {
LaunchedEffect(progress) {
val previousEntry = currentBackStack[currentBackStack.size - 2]
transitionState.seekTo(progress, previousEntry)
}
}
si...@gmail.com <si...@gmail.com> #19
Filed
Description
Component used: Activity
Versions used:
Devices/Android versions reproduced on: Pixel 7 API 35 (emulator)
Sample project:https://github.com/sindrenm/compose-navigation-crash-repro
This is a follow-up to 340202286 , since #39 requested we open a new issue. I have a sample project (linked above) that reproduces the issue consistently by using the debugger, but we're also seeing this crash happen for our users (same stack trace) in production builds with the same library versions. Note that we have not been able to reproduce it locally without using the debugger, but our users are.
The stack trace is as follows: