Status Update
Comments
ni...@minetilbud.dk <ni...@minetilbud.dk> #2
Then i updated to One UI 6.0, and now i can consistently reproduce the IndexOutOfBoundsException.
ni...@sveasolar.com <ni...@sveasolar.com> #3
Not limited to Samsung tho, we also have OnePlus and Sony users affected.
EDIT: I'm using version 2.9.0-alpha04 of the navigation library. But this crash goes way back.
The stacktrace is from 2.9.0-alpha04 tho.
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:79)
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)
th...@c0x12c.com <th...@c0x12c.com> #4
da...@gallatinapps.com <da...@gallatinapps.com> #5
Seeing this pop up again for us on some Samsung Galaxy S24 running Android 14.
navigation-compose 2.8.5
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)
la...@gmail.com <la...@gmail.com> #6
I am using navigation-compose = "2.8.6"
and the same error is thrown.
The majority of devices affected are:
- samsung dm3q
- samsung a52q
- realme REE2ADL1
- samsung b2q
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:104)
at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch (AndroidUiDispatcher.android.kt:79)
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
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
gl...@gmail.com <gl...@gmail.com> #7
Same issue:
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:100)
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
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
jm...@gmail.com <jm...@gmail.com> #8
I experience the same issue when calling popBackStack(), but not every time. There is no clear pattern to when the javaIndexOutOfBoundsException: Index -1 out of bounds for length 1
java error occurs. Sometimes it happens after one attempt, but other times it takes up to 20 attempts.
In version 2.8.7 of the library, the exception is simply caught and ignored? That doesn’t seem like a proper solution to me.
ma...@marcardar.com <ma...@marcardar.com> #9
My workaround for this is to use android:enableOnBackInvokedCallback="@bool/atLeastSdk35"
in the manifest (for how to declare atLeastSdk35
see:
Since predictive back is only enabled by default for Android 15+ devices, this is an acceptable workaround for me. The only downside being that Android 14 devices opted in to predictive back, won't actually get predictive back enabled for the app, but that beats crashing.
ce...@joinautopilot.com <ce...@joinautopilot.com> #10
BackHandler(
onBack = onBackPressed
)
basically the will override the predicted back gesture (Currently that is the issue)
al...@gmail.com <al...@gmail.com> #11
Seems like this feature is more trouble than it's worth
ka...@gmail.com <ka...@gmail.com> #12
Navigation library used: 2.8.0-alpha10
The crash happens when popBackStack() is called. it happens randomly though. However one way to reproduce this a bit more consistently, was to double tap on the software back (navigation toolbar) button quickly.
Description
Component used: androidx.navigation:navigation-compose
Version used: 2.8.5
Devices/Android versions reproduced on:
So far, we're only seeing this on Android 14. Devices affected (so far) are:
Even after getting the fixes for 340202286 and 375343407 , we're still seeing index-out-of-bounds crashes related to Predictive Back in navigation-compose. The stack trace is as follows:
The offending line is androidx/navigation/compose/NavHost.kt:620 :
We have not yet looked into reproducing this over the weekend, but the ways of reproducing the previous issues do not seem to work, as we tried that after navigation-compose 2.8.5 was released.