Search code examples
uno-platform

Uno Platform Android versions fails to run


I have started a test app to test out TabBar to replace my bottomNavigationBar as it is no longer available in Uno.Material. I have made a simple app that runs on Android, IOS, and UWP without issue. When I add the code in for Material- it runs fine on UWP and on IOS. However when I run it on Android, It will build and deploy but not run. Is there something else I need to do to get it run on Android? Note: I have Xamarin.AndroidX.AppCompat, and Xamarin.AndroidX.LifeCycle.LiveData installed per the instructions. I get the following error:

System.InvalidOperationException Message=Failed to load unoMaterialSample2.MainPage: System.MissingMethodException: Method not found: void Windows.UI.Xaml.UIElement.set_Name(string)

Here is my App.Xaml:

<Application
    x:Class="unoMaterialSample2.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:unoMaterialSample2">
    
    
                <!-- Place resources here -->
                <Application.Resources>
                    <ResourceDictionary>
                        <ResourceDictionary.MergedDictionaries>
                            <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                            <!-- Place resources here -->
                            <ToolkitResources xmlns="using:Uno.Toolkit.UI" />

                            <MaterialColors xmlns="using:Uno.Material" 
                                            OverrideSource="ms-appx:///Design/ColorPaletteOverride.xaml" />
                            <MaterialResources xmlns="using:Uno.Material" />

                            <MaterialToolkitColors xmlns="using:Uno.Toolkit.UI.Material" 
                                                   OverrideSource="ms-appx:///Design/ColorPaletteOverride.xaml" />
                            <MaterialToolkitResources xmlns="using:Uno.Toolkit.UI.Material" />

                        </ResourceDictionary.MergedDictionaries>
                    </ResourceDictionary>
                </Application.Resources>
           

</Application>

MainPage.Xaml:


<Page
    x:Class="unoMaterialSample2.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:unoMaterialSample2"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="using:Uno.UI.Toolkit"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid toolkit:VisibleBoundsPadding.PaddingMask="All">
        <Grid.RowDefinitions>
            <RowDefinition Height="70*"/>
            <RowDefinition Height="470*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock x:Name="testText" Grid.Row="0" Text="Hello, world!" Margin="20" FontSize="30" />
        <Button Grid.Row="1" Content="Example" Style="{StaticResource MaterialContainedButtonStyle}" Click="bClick" />
        <utu:TabBar Grid.Row="2" Style="{StaticResource MaterialBottomTabBarStyle}"
            xmlns:utu="using:Uno.Toolkit.UI">
            <utu:TabBar.Items>
                <utu:TabBarItem Content="Home">
                    <utu:TabBarItem.Icon>
                        <FontIcon Glyph="" />
                    </utu:TabBarItem.Icon>
                </utu:TabBarItem>
                <utu:TabBarItem Content="Support">
                    <utu:TabBarItem.Icon>
                        <FontIcon Glyph="" />
                    </utu:TabBarItem.Icon>
                </utu:TabBarItem>
                <utu:TabBarItem Content="About">
                    <utu:TabBarItem.Icon>
                        <FontIcon Glyph="" />
                    </utu:TabBarItem.Icon>
                </utu:TabBarItem>
            </utu:TabBar.Items>
        </utu:TabBar>
    </Grid>
</Page>


Solution

  • So- if anyone else runs into this, here is what I ended up doing to solve the issue. I had been ignoring the visual studio warning that Google Play indicates you need to compile with at least Android 11. Once I switched that in the Android project properties- voila - it compiled and is now working as expected.