In my .NET MAUI app, I use the built-in MediaPicker to access user's photos. The app works fine until I tap the icon to access the photos. It then crashes with the following error message:
Android.Content.Res.Resources+NotFoundException Message=Drawable com.mycompany.myapp:mipmap/appicon with resource ID #0x7f0d0000
I did replace the app icon recently and I also noticed that the app is not using it when I run the app on an actual device. I simply put a new svg file in the Resources/AppIcon folder with the same name as the original i.e. appicon.svg.
In the properties for this file, I set it as MAUIICON.
This is what's in the project file:
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" />
In case, it's helpful, this is how I'm using the MediaPicker:
try
{
var result = await MediaPicker.PickPhotoAsync(new MediaPickerOptions
{
Title = "Pick Image"
});
if (result == null)
return;
}
catch(Exception e)
{
// Log error
}
I never hit the catch block. It just crashes with the error message I mentioned above.
Any idea how to address this issue?