Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
A couple of questions:
1. Have you saw crash in real device or only in simulators?
2. Do you use dynamic feature for language ID?
1. Have you saw crash in real device or only in simulators?
2. Do you use dynamic feature for language ID?
jb...@google.com <jb...@google.com> #3
Tested on Android 12 Emulator with custom executor, but cannot repro this issue.
na...@google.com <na...@google.com> #4
-
Second crash in the description is from a real device. Experienced it myself on two different Xiaomi phones, plus lots of crashes from users in the Google Play console.
-
Dynamic features are not used in the application.
As a wild guess, I have downgraded build tools from 31.0.0 to 30.0.3, compileSdk from 31 to 30, and moved all work with Language ID to the service in a separate process (just to be sure that crash can kill secondary process instead of main). This combination is in beta for 2 days by now and I don't see any SIGSEGV crashes.
Description
Using
DynamicNavHostFragment
inandroidx.navigation:*:2.6.0-alpha05
cause an IllegalStateException when navigating.Stacktrace:
FATAL EXCEPTION: main Process: com.geekorum.rdv.bwemanje.debug, PID: 10981 java.lang.IllegalStateException: You cannot access the Navigator's state until the Navigator is attached at androidx.navigation.Navigator.getState(Navigator.kt:68) at androidx.navigation.fragment.FragmentNavigator.access$getState(FragmentNavigator.kt:53) at androidx.navigation.fragment.FragmentNavigator$1.onBackStackChangeCommitted(FragmentNavigator.kt:81) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1954) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1841) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1778) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565) at android.os.Handler.handleCallback(Handler.java:942) 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:7872) 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)
This is caused by registering an OnBackStackChangeListener when constructing FragmentNavigator .
DynamicNavHostFragment first create a regular
FragmentNavigator
that registers his OnBackStackChangeListener. This navigator is then replaced by aDynamicFragmentNavigator
. When the graph is created the navigators are all attached except the replaced FragmentNavigator which cause the crash as its OnBackStackChangeListener is still called.To reproduce use the following layout in an activity and cause a navigation