titanium-sdk
titanium-sdk copied to clipboard
Android: Crash related to fragments
I have searched and made sure there are no existing issues for the issue I am filing
- [X] I have searched the existing issues
Description
This is a follow-up on #12524 which unfortunately is not fully fixed, yet. We still get some crashes:
java.lang.IllegalArgumentException:
at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:513)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:282)
at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager$5.run (FragmentManager.java:524)
at android.os.Handler.handleCallback (Handler.java:808)
at android.os.Handler.dispatchMessage (Handler.java:101)
at android.os.Looper.loop (Looper.java:166)
at android.app.ActivityThread.main (ActivityThread.java:7529)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
A similar crash was reported for RN as well: https://github.com/software-mansion/react-native-screens/issues/463 and it seems like it could be something related to the "FragmentTransaction" class and how it is reused (which would make sense in a ListView context). And they seem to have fixed it in https://github.com/software-mansion/react-native-screens/pull/1006/files which looks like a doable change (reuse the transaction, change the Runnable
usage).
More possible fixes:
- https://stackoverflow.com/questions/69887210/no-view-found-for-id-0x7f0a000e-for-fragment-settingsfragment#comment123549723_69887701
Happy to sponsor any work on this fix again!
Expected Behavior
The app should not crash.
Actual behavior
The app should does crash.
Reproducible sample
See https://github.com/tidev/titanium_mobile/issues/13243
Steps to reproduce
See https://github.com/tidev/titanium_mobile/issues/13243
Platform
Android
SDK version you are using
10.2.0
Alloy version you are using
No response
I wonder if the reordering
already helps. I've added a test PR so you can try the actifacts https://github.com/tidev/titanium_mobile/pull/13400
Can you reproduce the crash all the time? Since the example still works fine here with the current 10.2.0
We just ordered a Xiaomi device to reproduce it (to be delivered by Wednesday). Your PR changes many parts, so I'm not sure if I can properly identify possible regressions. And I was just able to reproduce it, the error was:
[DEBUG] MapsInitializer: preferredRenderer: null
[DEBUG] zzca: preferredRenderer: null
[INFO] I/Google Maps Android API: Google Play services package version: 201817019
[ERROR] E/io.lambus.app: Invalid ID 0x00000005.
[DEBUG] AndroidRuntime: Shutting down VM
[INFO] I/com.example.myapp: WaitForGcToComplete blo
before moving to an ANR. And I assume the "invalid ID" is the ID of the fragment, which is recycled too fast when updating the list view too fast. I added a "debouncer" now, but you can reproduce it in our tr****n-v2
branch :)