Open Biyane opened 1 week ago
Hi @Biyane
I'm not aware of any issues with fragment navigation so far so I'll need more details to try and find the root cause. So if possible I'd like to get the following info:
Also, it'd be helpful to get the full stacktrace of the error if possible.
I'll be able to provide a better diagnosis and hopefully solve your issue once I can analyze that information.
@LikeTheSalad thank you, for the quick response.
It crashes not in every fragment, but in some fragments.
Fragment Navigation 2.5.3. I've upgraded to 2.7.7. and 2.8.0, didn't help.
---------------------------- PROCESS STARTED (7004) for package com.myPackge ----------------------------
2024-09-13 14:30:07.510 7004-7004 AndroidRuntime com.myPackge E FATAL EXCEPTION: main
Process: com.myPackge, PID: 7004
java.lang.IllegalArgumentException: The fragment SomeFragment{e594051} (077bd085-edf9-4c2e-8edd-da12b9259fbb id=0x7f0a0957 tag=46a48342-cdea-4c2b-9736-e1098c27f2de) is unknown to the FragmentNavigator. Please use the navigate() function to add fragments to the FragmentNavigator managed FragmentManager.
at androidx.navigation.fragment.FragmentNavigator$onAttach$2.onBackStackChangeCommitted(FragmentNavigator.kt:199)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1918)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
at androidx.fragment.app.FragmentManager.dispatchStart(FragmentManager.java:2959)
at androidx.fragment.app.Fragment.performStart(Fragment.java:3196)
at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:628)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:290)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:114)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1455)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3034)
at androidx.fragment.app.FragmentManager.dispatchStart(FragmentManager.java:2959)
at androidx.fragment.app.FragmentController.dispatchStart(FragmentController.java:274)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:358)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
at com.kostynchikoff.core_application.presentation.ui.activities.CoreAuthorizedActivity.onStart(CoreAuthorizedActivity.kt:55)
at com.alabs.globalfeature.presentation.commonUI.activity.authorized.main.BaseAuthorizedActivity.onStart(BaseAuthorizedActivity.kt:69)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1582)
at android.app.Activity.performStart(Activity.java:8977)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4198)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:225)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8893)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
---------------------------- PROCESS ENDED (7004) for package com.myPackge ----------------------------
Thank you for all those details, @Biyane
I took some time to modify the agent's sample app to try and match the same versions that you shared (except for the Android Gradle plugin one, I'm guessing you meant 8.4
?) but unfortunately no luck reproducing it.
Based on what you mentioned here:
It crashes not in every fragment, but in some fragments.
I was curious to know what could be the difference between those fragments. I tried adding the safeargs plugin to navigate from the first fragment to the second one by using the generated navigation actions, just to see if switching from ids to actions would trigger the error, though no luck.
Here's the place where I was focusing on during my tests. If you could identify what could I change there to try and trigger the error, or even better, if you happen to have an example project to reproduce this issue that I could take a look at, it would also help a lot.
Thank you for your patience.
We use Navigation Component for navigation. It works fine. When we add APM, it gives an error
What am I missing?