terrakok / Cicerone

🚦 Cicerone is a lightweight library that makes the navigation in an Android app easy.
Other
2.58k stars 218 forks source link

No view found for id #145

Open PavlikPetr opened 3 years ago

PavlikPetr commented 3 years ago

Hello. I'm having navigation problems. My app has a lot of crashes in google play console with the following log

java.lang.IllegalArgumentException
androidx.fragment.app.FragmentManagerImpl.moveToState

java.lang.IllegalArgumentException: 
  at androidx.fragment.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:875)
  at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManagerImpl.java:1238)
  at androidx.fragment.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1303)
  at androidx.fragment.app.BackStackRecord.executeOps (BackStackRecord.java:439)
  at androidx.fragment.app.FragmentManagerImpl.executeOps (FragmentManagerImpl.java:2079)
  at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether (FragmentManagerImpl.java:1869)
  at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute (FragmentManagerImpl.java:1824)
  at androidx.fragment.app.FragmentManagerImpl.execPendingActions (FragmentManagerImpl.java:1727)
  at androidx.fragment.app.FragmentManagerImpl$2.run (FragmentManagerImpl.java:150)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:192)
  at android.app.ActivityThread.main (ActivityThread.java:7169)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:504)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)

In AppCenter, the situation is similar, but the log is slightly different

androidx.fragment.app.FragmentManagerImpl.moveToState
FragmentManagerImpl.java, line 875
java.lang.IllegalArgumentException: No view found for id

Stack traces
androidx.fragment.app.FragmentManagerImpl.moveToState FragmentManagerImpl.java:875
androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState FragmentManagerImpl.java:1238
androidx.fragment.app.FragmentManagerImpl.moveToState FragmentManagerImpl.java:1303
androidx.fragment.app.BackStackRecord.executeOps BackStackRecord.java:439
androidx.fragment.app.FragmentManagerImpl.executeOps FragmentManagerImpl.java:2079
androidx.fragment.app.FragmentManagerImpl.executeOpsTogether FragmentManagerImpl.java:1869
androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute FragmentManagerImpl.java:1824
androidx.fragment.app.FragmentManagerImpl.execPendingActions FragmentManagerImpl.java:1727
androidx.fragment.app.FragmentManagerImpl$2.run FragmentManagerImpl.java:150
android.os.Handler.handleCallback Handler.java:873
android.os.Handler.dispatchMessage Handler.java:99
android.os.Looper.loop Looper.java:192
android.app.ActivityThread.main ActivityThread.java:7169
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:504
com.android.internal.os.ZygoteInit.main ZygoteInit.java:858

I cannot reproduce the problem myself. I suppose that when calling a new fragment from a fragment, you would need to use the childFragmentManager. How can this problem be solved by cicerone?

terrakok commented 3 years ago

Library uses system fragment manager so i think there is bug in your code. Could you create small reproducer app?