I'm upgrading an existing application from Xamarin.Android to .Net7 Android and running into issues trying to use Maui Essentials. In my .csproj file I have included these 2 lines
<UseMaui>True</UseMaui>
<UseMauiEssentials>True</UseMauiEssentials>
I also have Xamarin Essentials installed as I was using that before Maui existed. Now I get build errors related to the android manifest
/Project.Android/AndroidManifest.xml : error APT2260: resource xml/microsoft_maui_essentials_fileprovider_file_paths (aka com.app.package:xml/microsoft_maui_essentials_fileprovider_file_paths) not found. [/Project.Android.csproj]
/Project.Android/AndroidManifest.xml : error APT2260: resource xml/xamarin_essentials_fileprovider_file_paths (aka com.app.package:xml/xamarin_essentials_fileprovider_file_paths) not found. [/Project.Android.csproj]
There seem to be a few others referencing "xml/library_file_paths" and "integer/google_player_services_version". I'm not sure if it has anything to do with Maui but this is the first time noticing the issue. It may be more of a .Net7 thing. Currently working in Visual Studio Code on a mac if it matters.
No action is required to use
Xamarin.Essentialsin .NET MAUI app, other than removing references to theXamarin.Essentialsnamespace, because .NET MAUI already includes the functionality from Xamarin.Essentials.So you can try to first remove the Xamarin.Essentials NuGet package from your .NET Android app.
Then initialize the "essentials" functionality by calling the Platform.Init method in MainActivity class:
For more details, you can refer to Migrate Xamarin.Essentials code in .NET Android apps