Closed alashow closed 5 years ago
Am I the only getting this crash? There have been 7 instances reported by Crashlytics
You should use 3.0 then you will not have to call the executePendingTransactions.
Or as a quick and nasty workaround put a try-catch around it
Does 3.0 version uses androidx
now?
Looks like it's not. I had some building issues with Android Jetifier last time, let me try again though.
There's a PR for that: https://github.com/ncapdevi/FragNav/pull/178
I just tried 3.0, and the build passed okay.
Do we just remove navController.executePendingTransactions()
now?
BTW, it will be a nice addition to upgrade to androidx now. Even without build issues, it's less job to do for Android Jetifier
Yeah hopefully that will do it. If you experience anything weird please report back.
Will do! Closing for now.
Apparently, It wasn't fixed yet. Still same error. Using v3.0.0 and not calling executePendingTransactions anywhere.
at androidx.fragment.app.FragmentManagerImpl.checkStateLoss(SourceFile:2080)
at androidx.fragment.app.FragmentManagerImpl.enqueueAction(SourceFile:2106)
at androidx.fragment.app.BackStackRecord.commitInternal(SourceFile:683)
at androidx.fragment.app.BackStackRecord.commit(SourceFile:637)
at com.ncapdevi.fragnav.FragNavController.addPreviousFragment(SourceFile:677)
at com.ncapdevi.fragnav.FragNavController.createTransactionWithOptions(SourceFile:364)
at com.ncapdevi.fragnav.FragNavController.addPreviousFragment(SourceFile:32)
at com.ncapdevi.fragnav.FragNavController$DefaultFragNavPopController.tryPopFragments(SourceFile:875)
at com.ncapdevi.fragnav.tabhistory.CurrentTabHistoryController.popFragments(SourceFile:13)
at com.ncapdevi.fragnav.FragNavController.getRootFragment(SourceFile:329)
at com.ncapdevi.fragnav.FragNavController.addPreviousFragment(SourceFile:375)
at app.base.BaseFragNavActivity.navigate(SourceFile:70)
at app.main.payment.web.PaymentWebFragment$onDone$1.invoke(SourceFile:30)
at app.main.payment.web.PaymentWebFragment$onDone$1.invoke(SourceFile:25)
at app.main.payment.web.PaymentWebViewClient.isCallbackUrl(SourceFile:62)
at app.main.payment.web.PaymentWebViewClient.shouldOverrideUrlLoading(SourceFile:34)
at apM.a(SourceFile:1)
at xq.b(SourceFile:81)
at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(SourceFile:172)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:328)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:6269)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
This is not the same stack trace
The problem here is that you're trying to commit a fragment when the activity's state is not ready for it (already started to finish or inside configuration change). You either make sure that in the callback you make sure that navigation happens only inside the activity's active lifecycle or set TransactionOptions allowStateLoss to true
Article on this matter: https://medium.com/inloopx/demystifying-androids-commitallowingstateloss-cb9011a544cc
Thanks! Will report back once I try fixing it.
@alashow Will assume it's fixed since we didn't hear back. Comment again if there's an issue and I can reopen this.
How can I avoid this exception?
76's line is
navController.executePendingTransactions()
: