accompanist
accompanist copied to clipboard
[Navigation] Sometimes crash occurs while hiding the dialog
Description I see some crash reports in Firebase. It seems there is a state when the anchors are not calculated, and we navigate away from the dialog.
Fatal Exception: java.lang.IllegalArgumentException: The target value must have an associated anchor.
at androidx.compose.material.SwipeableState$snapTo$$inlined$collect$1.emit(Collect.kt:136)
at kotlinx.coroutines.flow.FlowKt__LimitKt.emitAbort$FlowKt__LimitKt(Limit.kt:73)
at kotlinx.coroutines.flow.FlowKt__LimitKt.access$emitAbort$FlowKt__LimitKt(Limit.kt:1)
at kotlinx.coroutines.flow.FlowKt__LimitKt$take$lambda-7$$inlined$collect$1.emit(Collect.kt:138)
at androidx.compose.material.SwipeableState$special$$inlined$filter$1$2.emit(Collect.kt:137)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:77)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:59)
at androidx.compose.runtime.SnapshotStateKt$snapshotFlow$1.invokeSuspend(SnapshotState.kt:891)
at androidx.compose.runtime.SnapshotStateKt$snapshotFlow$1.invoke(SnapshotState.kt:2)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(SafeFlow.java:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
at androidx.compose.material.SwipeableState$special$$inlined$filter$1.collect(SafeCollector.common.kt:114)
at kotlinx.coroutines.flow.FlowKt__LimitKt$take$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:116)
at androidx.compose.material.SwipeableState.snapTo(SwipeableState.java:943)
at com.google.accompanist.navigation.material.SheetContentHostKt.internalHide(SheetContentHostKt.java:188)
at com.google.accompanist.navigation.material.SheetContentHostKt.access$internalHide(SheetContentHostKt.java:1)
at com.google.accompanist.navigation.material.SheetContentHostKt$SheetContentHost$2$2$1.invokeSuspend(SheetContentHost.kt:145)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
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:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7838)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Steps to reproduce I could not create a reproducing code, yet.
Expected behavior
This code is already wrapped in a try block, maybe it should catch all exceptions just to be sure.
@WonderCsabo Thanks for the report. Do you have the exception that's thrown by chance?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
@jossiwolf sorry for the late response. I edited the stacktrace!
I just realized this might be a duplicate, we also discussed it here: https://github.com/google/accompanist/issues/910#issuecomment-1041872681.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is still happening very frequently according to our Crashlytics reports.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Still happenning.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is still happening.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is still happening.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is still happening.
@jossiwolf can you reopen this, please?
Upstream issue for the root cause: https://issuetracker.google.com/issues/167966118 We're working on it but it will still take some time to address.
v0.29.0-alpha addresses this issue. Please let us know if you can still reproduce it with this version.
Hey @jossiwolf - it seems that v0.28.1 has not been released yet - wanted to ask if this is expected
Apologies, it's v0.29.0-alpha.