r/xamarindevelopers • u/LimonCaducado • Jun 03 '21
Android.Content.Res.Resources+NotFoundException Message=Unable to find resource ID #0xffffffff
Please, I'm going a bit mad here.
I have a Xamarin Android app. In here, I use a Tabbar to host a LogInPage. When the user clicks to login, it is supposed to take them to the first page of a FlyoutMenu. However, when I attempt to do so, the app breaks and I'm given the following message:
Android.Content.Res.Resources+NotFoundException Message=Unable to find resource ID #0xffffffff This happens whenever I try to make a move inside the Shell, no matter where I start from or where I am going. The only page that loads correctly is the one that I set to load on App.OnStart().
I have looked for the ID in Resource.Designer.cs, and it brings up this:
// aapt resource value: { 0xFFFFFFFF }
public static int[] ActionMenuView = new int[] {
-1};This is my AppShell:
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:CaminanteFinal.Views"
Title="CaminanteFinal"
x:Class="CaminanteFinal.AppShell"
x:Name="shelly">
<Shell.Resources>
<ResourceDictionary>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
<Setter Property="Shell.TabBarTitleColor" Value="White"/>
</Style>
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
<Style TargetType="FlyoutItem" BasedOn="{StaticResource BaseStyle}" />
<Style Class="FlyoutItemLabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="White"></Setter>
</Style>
<Style Class="FlyoutItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{x:OnPlatform UWP=Transparent, iOS=White}" />
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{StaticResource Primary}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style Class="MenuItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
</ResourceDictionary>
</Shell.Resources>
<FlyoutItem Title="About" Icon="icon_about.png">
<ShellContent Route="ChrListPage" ContentTemplate="{DataTemplate local:ChrListPage}" />
</FlyoutItem>
<FlyoutItem Title="Browse" Icon="icon_feed.png">
<ShellContent Route="Encyclopedia" ContentTemplate="{DataTemplate local:Encyclopedia}" />
</FlyoutItem>
<MenuItem Text="Logout" StyleClass="MenuItemLayoutStyle" Clicked="OnMenuItemClicked">
</MenuItem>
<TabBar>
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate local:LoginPage}" />
</TabBar>
</Shell>My App.xaml.cs:
public App()
{
InitializeComponent();
//DependencyService.Register<MockDataStore>();
AppShell shell = new AppShell();
MainPage = shell;
}
protected override void OnStart()
{
try
{
FireBaseActions.client = new FirebaseClient(FireBaseActions.irc);
Shell.Current.GoToAsync("//LoginPage");
}
catch (InvalidOperationException exception)
{
//Mostramos error en caso de no poder conectar.
Acr.UserDialogs.UserDialogs.Instance.Alert("You will be working with local information, some functions will not work","Couldn't connect to Firebase", "Ok");
}
}And my LogIn method:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPage : ContentPage
{
IAuth auth;
public LoginPage()
{
InitializeComponent();
auth = DependencyService.Get<IAuth>();
}
async void LoginClicked(object sender, EventArgs e)
{
try
{
Shell shell = Shell.Current;
await shell.GoToAsync($"//Encyclopedia");
}
catch(Android.Content.Res.Resources.NotFoundException ex)
{
ex.PrintStackTrace();
}
}
}Creating a new app does not work, the same thing happens. Any ideas?
0
Upvotes
1
u/jim-dog-x Jun 04 '21
Just skimming the code, I'm wondering if you need to set a value for Android here:
<Setter Property="BackgroundColor" Value="{x:OnPlatform UWP=Transparent, iOS=White}" />
You define a value for UWP and iOS, but not Android.