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

AppShell crashed on Android with "No view found for id 0x1 (unknown) for fragment ShellItemRenderer..." #7940

Closed
jzhao8402 opened this issue Jun 10, 2022 · 12 comments · Fixed by #8455
Assignees
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-6.0.419 Look for this fix in 6.0.419! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@jzhao8402
Copy link

Description

I'm working on an android app using MAUI GA and encounter an annoying error of "java.lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment ShellItemRenderer..." w/o a fix. I have spent a couple of days debugging and searching but no solution found. To a point that I have to believe this must be a MAUI AppShell bug. I have created a repository on github of the simple MAUI project in case anyone wants to check.

https://github.com/jzhao8402/MauiApp1

The project is actual a barebone AppShell project with only two flyout items for a Login Page and a About Page. But it's good enough to reproduce the problem. I'm able to re-produce the bug on both the android emulator and physical devices. Not sure if I missed any critical thing to make this simple shell working properly. Any help or hint would be appreciated. I'm frustrated because I need to build my faith to go with .Net MAUI. On top of this one, I'm also struggling with the Google Firebase push notification, android alert sound. None of these is out of box of MAUI.

Steps to Reproduce

  1. Launch the app, it'll work well on freshly start and you can use the flyout menu to switch the pages back and forth.
  2. Use the android back button to "close" the app.
  3. Tap the app icon to relaunch the app, or use the android history button to find the app in the stack and bring it back; the app will display the last page before you closed the app.
  4. Use the flyout menu to switch the page, the app will crash instantly with the following error:
    Java.Lang.IllegalArgumentException: 'No view found for id 0x1 (unknown) for fragment ShellItemRenderer

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 21 & up

Did you find any workaround?

Not yet.

Relevant log output

[nyname.mauiapp] Invalid ID 0x00000001.
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: com.companyname.mauiapp1, PID: 17697
[AndroidRuntime] java.lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment ShellItemRenderer{5a58e67} (8afe0b23-ef5c-4497-802e-ae781435f2f3 id=0x1)
[AndroidRuntime] 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:513)
[AndroidRuntime] 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
[AndroidRuntime] 	at android.os.Handler.handleCallback(Handler.java:938)
[AndroidRuntime] 	at android.os.Handler.dispatchMessage(Handler.java:99)
[AndroidRuntime] 	at android.os.Looper.loop(Looper.java:223)
[AndroidRuntime] 	at android.app.ActivityThread.main(ActivityThread.java:7656)
[AndroidRuntime] 	at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
[AndroidRuntime] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
**Java.Lang.IllegalArgumentException:** 'No view found for id 0x1 (unknown) for fragment ShellItemRenderer{5a58e67} (8afe0b23-ef5c-4497-802e-ae781435f2f3 id=0x1)'
@jzhao8402 jzhao8402 added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jun 10, 2022
@jzhao8402 jzhao8402 changed the title AppShell crashed on Android AppShell crashed on Android with "No view found for id 0x1 (unknown) for fragment ShellItemRenderer..." Jun 11, 2022
@MartinRothschink
Copy link

See also discussion here #7878 (comment)

@VincentBu
Copy link

I'm using vs main build 32611.49. I can't repro but we did run into similar error before.

@VincentBu VincentBu added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jun 13, 2022
@Eilon Eilon added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Jun 13, 2022
@MartinRothschink
Copy link

MartinRothschink commented Jun 13, 2022

I'm using vs main build 32611.49. I can't repro but we did run into similar error before.

What device/emulator have you used to reproduce the issue? I made some more tests today.

Physical devices
On my Moto E4 (Android 7.1) it crashes immediately
On my Nokia X10 (Android 12) it takes 40-50 menu changes to crash.
On my Xiaomi pad 5 (Android 12) it takes more than 50 menu changes to crash.

Emulators
Pixel 5 (Android 12) it does not crash after 10 tries.
Pixel 4 (Android 11) it crashes immediately
Pixel 4 (Android 10) it crashes immediately.

@MartinRothschink
Copy link

Currently that's a real show stopper for my customers. The app crashes often and randomly.

@jzhao8402
Copy link
Author

...

What device/emulator have you used to reproduce the issue? I made some more tests today.

Emulator:
Pixel 5 - android 11, crashes immediately

Physical Phone:
Samsung A12 - android 11, crashes immediately

@jzhao8402
Copy link
Author

I'm using vs main build 32611.49. I can't repro but we did run into similar error before.

The following is my vs info:
Microsoft Visual Studio Community 2022
Version 17.3.0 Preview 1.1
VisualStudio.17.Preview/17.3.0-pre.1.1+32519.111

Is is just a tooling issue? Where to download the vs main build 32611.49?

@jzhao8402
Copy link
Author

I updated my Visual Studio to version 17.3.0 preview 2.0. However, the problem is still. The app crashed with the same error when it came back from background and then navigated to another page. I like the Shell routing but I agree with Martin Rothschink: this is a show stopper.

The error: java.lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment ShellItemRenderer
My repro project: https://github.com/jzhao8402/MauiApp1
My Emulator: Pixel 5 - android 11
My Phone: Samsung A12 - android 11

My Visual Studio:
Microsoft Visual Studio Community 2022
Version 17.3.0 Preview 2.0
VisualStudio.17.Preview/17.3.0-pre.2.0+32611.2
Microsoft .NET Framework
Version 4.8.04161

@Realinspirer
Copy link

What's with Windows Subsystem for Android™️? Literally every bug that I am experiencing on a physical device cannot be seen on WSA? Huh? This is one of the new issue that I am encountering, that I had never encountered on WSA.

So, anyone testing their app with WSA as their main thing, be sure to try their app on other devices time to time.

I think this bug has some association with the behavior of Shell in MAUI. The app crash mostly happens after you have spend some quality time on a page, (like working - clicking, writing, not mostly idle). And then if you try to jump to another page using Shell, it like gives the Shell a surprise attack. It may be because of the fact that Shell cache pages that has been opened before for faster navigating. So, while it tries to fetch a page cache that's never opened before, the app crashes in the meanwhile. Okay that may not actually be true, but this bug is super fatal. App crashes randomly. It makes the app almost unusable. Data loss can be super common.
Oh my god, such a long day. I hope this bug gets patched.

@enter-is
Copy link

this seems to be happening when activity dies, easiest way to replicate is to enable "Don't keep activities" option in the Developer options in settings, then just switching to another app and back would trigger killing activities of the app, which will surface the bug

@PureWeen PureWeen added this to the 6.0-sr3 milestone Jun 22, 2022
@DeepWorksStudios
Copy link

I can confirm that this bug also accures on my project.

@PureWeen PureWeen linked a pull request Jun 30, 2022 that will close this issue
@PureWeen PureWeen closed this as completed Jul 5, 2022
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jul 12, 2022
@jzhao8402
Copy link
Author

When the fix will be available? Visual Studio 17.3.0 Preview 3.0 just released and the problem is still there.

@jzhao8402
Copy link
Author

I just confirmed with the newly release vs17.3.0 preview 4.0, the problem is finally fixed.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2022
@samhouts samhouts added the fixed-in-6.0.419 Look for this fix in 6.0.419! label Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-6.0.419 Look for this fix in 6.0.419! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants