google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.31k stars 592 forks source link

[BottomSheetNavigator] NullPointerException (race-condition?) when using back button #1733

Closed alixwar closed 4 months ago

alixwar commented 7 months ago

Describe the bug

This is a crash reported from an analytics tool so I cannot give more details than the stacktrace and the devices where the issues were found.

To Reproduce

Steps to reproduce the behavior:

Fatal Exception: java.lang.NullPointerException:
       at com.google.accompanist.navigation.material.BottomSheetNavigator$sheetContent$1$2.invoke(BottomSheetNavigator.kt:224)
       at com.google.accompanist.navigation.material.BottomSheetNavigator$sheetContent$1$2.invoke(BottomSheetNavigator.kt:223)
       at androidx.activity.compose.BackHandlerKt$BackHandler$backCallback$1$1.handleOnBackPressed(BackHandler.kt:89)
       at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.kt:276)
       at androidx.activity.OnBackPressedDispatcher$5.invoke(OnBackPressedDispatcher.kt:134)
       at androidx.activity.OnBackPressedDispatcher$5.invoke(OnBackPressedDispatcher.kt:134)
       at androidx.activity.OnBackPressedDispatcher$Api33Impl.createOnBackInvokedCallback$lambda$0(OnBackPressedDispatcher.kt:369)
       at android.view.ViewRootImpl$NativePreImeInputStage.onProcess(ViewRootImpl.java:7558)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7213)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10788)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:10676)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:10632)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:10926)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:285)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:335)
       at android.os.Looper.loopOnce(Looper.java:186)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8757)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) 

Expected behavior

A clear and concise description of what you expected to happen.

Environment:

Additional context

Add any other context about the problem here.

github-actions[bot] commented 5 months ago

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.

lildeeOg commented 5 months ago

Any update on this? I also see this one in crashlytics on multiple devices/os

luisccm commented 5 months ago

Same here, this one in happening on multiple devices/os

ZhaohuaZeng-at commented 5 months ago

I also see a similar crash and paste the stacktrace here


                                                                                                    java.lang.NullPointerException
                                                                                                        at com.google.accompanist.navigation.material.BottomSheetNavigator$sheetContent$1$2.invoke(BottomSheetNavigator.kt:191)
                                                                                                        at com.google.accompanist.navigation.material.BottomSheetNavigator$sheetContent$1$2.invoke(BottomSheetNavigator.kt:190)
                                                                                                        at androidx.activity.compose.BackHandlerKt$BackHandler$backCallback$1$1.handleOnBackPressed(BackHandler.kt:89)
                                                                                                        at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.kt:276)
                                                                                                        at androidx.activity.ComponentActivity.onBackPressed(ComponentActivity.java:678)
                                                                                                        at android.app.Activity.onKeyUp(Activity.java:3921)
                                                                                                        at android.view.KeyEvent.dispatch(KeyEvent.java:2925)
                                                                                                        at android.app.Activity.dispatchKeyEvent(Activity.java:4264)
                                                                                                        at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120)
                                                                                                        at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
                                                                                                        at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138)
                                                                                                        at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604)
                                                                                                        at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:60)
                                                                                                        at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3413)
                                                                                                        at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:402)
                                                                                                        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6708)
                                                                                                        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6574)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6034)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6091)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6057)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6222)
                                                                                                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6065)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6279)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6038)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6091)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6057)
                                                                                                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6065)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6038)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6091)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6057)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6255)
                                                                                                        at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6435)
                                                                                                        at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3649)
                                                                                                        at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3169)
                                                                                                        at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3160)
                                                                                                        at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3626)
                                                                                                        at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
                                                                                                        at android.os.MessageQueue.nativePollOnce(Native Method)
                                                                                                        at android.os.MessageQueue.next(MessageQueue.java:335)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:161)
                                                                                                        at android.os.Looper.loop(Looper.java:288)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7918)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

we are on accompanist 0.34.0 device is pixel 6a, Android version 13

LluisFelip commented 4 months ago

Attempting to fix this here 🙏🏼

ianhanniballake commented 4 months ago

With the release of Compose Material 1.7.0-alpha04, the Material team has added a new artifact: androidx.compose.material:material-navigation, which fully replaces Accompanist Navigation Material.

As such, we are closing all issues here on Accompanist and will be fully deprecating Accompanist Navigation Material in an upcoming release.

A number of issues were fixed as part of the migration, but if you're still seeing an issue, please file an issue with a sample project that reproduces your issue and the Material team will take a look.