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

TabbedPage inside a ShellContent fails on Android with Java.Lang.IllegalArgumentException #3741

Closed
emorell96 opened this issue Dec 12, 2021 · 3 comments
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/android 🤖 t/bug Something isn't working

Comments

@emorell96
Copy link

emorell96 commented Dec 12, 2021

Description

So I am trying to use a TabbedPage inside a ShellContent. On Windows all works, but on Android you get an exception when the app loads, or you navigate to the tabbed page.

The code is simple:

This is inside App.xaml

    <Application.MainPage>
        <Shell>
            <ShellContent Title="TabbedPage" Route="TabbedPage" ContentTemplate="{DataTemplate local:TabbedPageExample}" />
            <ShellContent Title="ContentPage" Route="ContentPage" ContentTemplate="{DataTemplate local:MainPage}" />
        </Shell>
    </Application.MainPage>

The local:TabbedPageExample is just a TabbedPage with two empty ContentPage inside the TabbedPage.Children. You can see the code in the github I linked at the end.

Windows WinUI example:
image

On Android it just fails with the exception:

Java.Lang.IllegalArgumentException
Message=No view found for id 0x7f08013d (com.companyname.TabbedPageBugDemo:id/navigationlayout_toptabs) for fragment ViewFragment{7e5f7b2} (bec44d9c-f254-4734-854a-1a8f9615c311 id=0x7f08013d)

I have created a minimal version to showcase the bug. You can find it here: https://github.com/StockDrops/TabbedPageBugDemo

Thank you!

Steps to Reproduce

  1. Create a new MAUI app from the Visual Studio template.
  2. Create a shell with a tabbed page.
  3. The app fails when you visit the tabbed page through the shell navigation or when the shell loads if it's the main page.

Version with bug

Preview 10 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

API 30, Android 11

Did you find any workaround?

No response

Relevant log output

[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: com.companyname.TabbedPageBugDemo, PID: 30772
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(Fragm12-12 00:46:37.721 E/AndroidRuntime(30772): java.lang.IllegalArgumentException: No view found for id 0x7f08013d (com.companyname.TabbedPageBugDemo:id/navigationlayout_toptabs) for fragment ViewFragment{7e5f7b2} (bec44d9c-f254-4734-854a-1a8f9615c311 id=0x7f08013d)
[AndroidRuntime] 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:513)
[AndroidRuntime] 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2106)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
[AndroidRuntime] 	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
[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 0x7f08013d (com.companyname.TabbedPageBugDemo:id/navigationlayout_toptabs) for fragment ViewFragment{7e5f7b2} (bec44d9c-f254-4734-854a-1a8f9615c311 id=0x7f08013d)'
@emorell96 emorell96 added the t/bug Something isn't working label Dec 12, 2021
@emorell96 emorell96 changed the title TabbedPage inside a ShellContent fails on Android with TabbedPage inside a ShellContent fails on Android with Java.Lang.IllegalArgumentException Dec 12, 2021
@jsuarezruiz jsuarezruiz added area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/android 🤖 labels Dec 13, 2021
@PureWeen
Copy link
Member

PureWeen commented Jan 5, 2022

Mixing TabbedPage and FlyoutPage with Shell is currently not supported this experience might be better once we get to P13 but it won't be officially supported until after the NET6

@PureWeen PureWeen closed this as completed Jan 5, 2022
@Dreamescaper
Copy link

Is it possible at least to throw a better exception if that's not a supported scenario?

@ghost ghost locked as resolved and limited conversation to collaborators Mar 1, 2022
@PureWeen
Copy link
Member

Duplicate of #6389

@PureWeen PureWeen marked this as a duplicate of #6389 Oct 18, 2022
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 platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants