Search code examples
android.netmauitabbedpage.net-maui.shell

.NET Maui TabbedPage does not work on Android


I have the same issue as this thread

When I load my app on Windows Machine, NO ISSUE. However on Android I have an Exception pointing on the constructor of my TabbedPage

public partial class AppTabbedPage
{
    public AppTabbedPage()
    {
        InitializeComponent();
    }
}

If anyone know how to make works TabbedPage on Android?


Update: I found a solution to my issue. It was a file that won't load when booting on Android. After a few investigations I found out how to load custom files with .NET Maui on this Thread which led me to this page of the Docs.

Thank You!


Solution

  • I found a solution. It was a file that won't load when booting on Android. After a few investigations I found out how to load custom files with .NET Maui on this Thread which led me to this page of the Docs.


    To summarize, I found that it is not advised to load custom files to a .NET Maui app using:

    • var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Folder", fileName);
    • Or using const string filePath = "FullPath\\to\\File".

    Instead, there's a method inside Resources\Raw\AboutAssets.txt directing on how to use assets such as files. Which I did and it works. However, I didn't use the returning async Task method way I just ReadToEnd() the StreamReader as soon as it gets the file path.

    For those who are interested can look at my project on GitHub.

    Thank You for your HELP!