Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRENDING CRASH] IllegalArgumentException: No view found for id 0x42dc8 (unknown) for fragment #2749

Closed
gino-m opened this issue Sep 19, 2024 · 4 comments · Fixed by #2877
Closed
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@gino-m
Copy link
Collaborator

gino-m commented Sep 19, 2024

Occurred 17 times over last 7 days in Open Foris Ground 0.1.9 prod on Android 12, 13, and 14 on multiple devices.

Fatal Exception: java.lang.IllegalArgumentException: No view found for id 0x42dc8 (unknown) for fragment DrawAreaTaskMapFragment{3f3486a} (a77cc8b6-7841-4ca9-a1f3-1a66d701904b id=0x42dc8 tag=DrawAreaTaskMapFragment)
       at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:567)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:286)
       at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2164)
       at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2059)
       at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
       at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:702)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8913)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
@gino-m gino-m added the type: bug Something isn't working label Sep 19, 2024
@gino-m gino-m added this to Ground Sep 19, 2024
@sufyanAbbasi
Copy link
Contributor

sufyanAbbasi commented Sep 20, 2024

Taking a look now, the initial theory is that it's somewhat related to #2493 which was fixed by #2588.

I did do the prime number magic for this type of DrawAreaTaskFragment to mitigate ID collisions:

val rowLayout = LinearLayout(requireContext()).apply { id = View.generateViewId() * 11411 }

In this case, I don't think adding the prime number offset is necessarily causing the ID to not be looked up properly, since the normal case seems to work ok. Unfortunately, without a repro, it will be difficult to tell what the main cause is, but I have found some sources online that may point to a general cause, due to nested fragments:
https://stackoverflow.com/questions/7508044/android-fragment-no-view-found-for-id

@gino-m
Copy link
Collaborator Author

gino-m commented Sep 20, 2024

Hm.. I can't repro either, but I suspect it's related to restoring the app from the background, since under normal circumstances the TaskMapFragments are created by the our Fragment rather than the FragmentStateManager. I wonder if this is a side effect of #2725?

@gino-m
Copy link
Collaborator Author

gino-m commented Nov 17, 2024

@sufyanAbbasi @anandwana001 This is still the most common app crash (51 crashes in the last 7 days). Grabbing time to discuss tomorrow @kenstershiro @jabramowitz5 @lecrabe @jo-spek FYI

@gino-m
Copy link
Collaborator Author

gino-m commented Nov 25, 2024

@anandwana001 Suggested migrating to compose may help, but I noted it will require significant effort to migrate all data collection tasks and the controlling logic over. In the meantime, we should try to stop the crashes ASAP. Assigning to @anandwana001 to take a look.

@gino-m gino-m assigned anandwana001 and unassigned sufyanAbbasi Nov 25, 2024
@anandwana001 anandwana001 moved this from Todo to In Progress in Ground Nov 27, 2024
@kenstershiro kenstershiro added this to the GA release milestone Dec 4, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Ground Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants