Share via

I am trying to integrate Firebase Analytics and Crashlytics into a .NET MAUI (.NET 10) Android application, but I am facing a runtime exception related to Crashlytics.

Vignesh Palthurai 0 Reputation points
2026-04-06T11:36:26.9566667+00:00

Steps I followed:

Created a new .NET MAUI project

Created a Firebase project and added an Android app

Ensured the ApplicationId matches the package name

Added google-services.json to: Platforms/Android/google-services.json

Set Build Action to GoogleServicesJson

Installed the following NuGet packages:

Plugin.Firebase
Plugin.Firebase.Analytics

Plugin.Firebase.Crashlytics
Configuration:

ApplicationId in .csproj: com.companyname.firebasepocapp

Package name in AndroidManifest.xml: com.companyname.firebasepocapp

Error:

At runtime, I get the following exception:
Java.Lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: The Crashlytics build ID is missing.
What I have tried:

Verified google-services.json placement and build action

Ensured package names match

Cleaned and rebuilt the solution

Questions:

Is additional Android Gradle configuration required for Crashlytics in .NET MAUI (.NET 10)?

Does Plugin.Firebase fully support Crashlytics for .NET 10?

Is there any required initialization code or setup missing for Analytics and Crashlytics?

Any guidance or working setup example would be helpful.

Environment:

.NET MAUI (.NET 10)

Android target

Visual Studio 2026

  • Plugin.Firebase (latest available version)
Developer technologies | .NET | .NET MAUI
0 comments No comments

2 answers

Sort by: Most helpful
  1. Nancy Vo (WICLOUD CORPORATION) 2,655 Reputation points Microsoft External Staff Moderator
    2026-04-16T04:26:58.05+00:00

    Hi @Vignesh Palthurai ,

    I’ve tested this on my device and it works as expected. I have a few notes before sharing the code examples.

    • I’m using the same version (4.0.0) for all three packages in the .csproj. I recommend doing the same.
    <PackageReference Include="Plugin.Firebase" Version="4.0.0" />
    <PackageReference Include="Plugin.Firebase.Analytics" Version="4.0.0" />
    <PackageReference Include="Plugin.Firebase.Crashlytics" Version="4.0.0" />
    
    • Because I encountered an SDK-related error, I changed the minimum Android API level from 21 to 23:
    <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23.0</SupportedOSPlatformVersion>
    
    • You still need to keep strings.xml (Platforms/Android/Resources/values/strings.xml), as mentioned earlier:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <string name="com.google.firebase.crashlytics.mapping_file_id">none</string>
      <string name="com.crashlytics.android.build_id">1.0</string>
    </resources
    
    • We must also include the following configuration in the .csproj file:
    <ItemGroup Condition="'$(TargetFramework)' == 'net10.0-android'">
      <GoogleServicesJson Include="Platforms\Android\google-services.json" />
    </ItemGroup>
    

    You can refer to following code examples:

    This is MauiProgram.cs:

    using Microsoft.Extensions.Logging;
    using Microsoft.Maui.LifecycleEvents;
    
    #if IOS || ANDROID
    using Plugin.Firebase.Analytics;
    using Plugin.Firebase.Crashlytics;
    #endif
    
    #if IOS
    using Plugin.Firebase.Core.Platforms.iOS;
    #elif ANDROID
    using Plugin.Firebase.Core.Platforms.Android;
    #endif
    
    namespace MauiApp2;
    
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
    
            builder
                .UseMauiApp<App>()
                .RegisterFirebaseServices()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                    fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
                });
    
    #if DEBUG
            builder.Logging.AddDebug();
    #endif
    
            return builder.Build();
        }
    
        private static MauiAppBuilder RegisterFirebaseServices(this MauiAppBuilder builder)
        {
    #if IOS || ANDROID
            builder.ConfigureLifecycleEvents(events =>
            {
    #if IOS
                events.AddiOS(iOS => iOS.WillFinishLaunching((_, _) =>
                {
                    CrossFirebase.Initialize();
                    return false;
                }));
    #elif ANDROID
                events.AddAndroid(android => android.OnCreate((activity, _) =>
                {
                    CrossFirebase.Initialize(activity, () => Microsoft.Maui.ApplicationModel.Platform.CurrentActivity);
                    FirebaseAnalyticsImplementation.Initialize(activity);
                }));
    #endif
            });
    
            builder.Services.AddSingleton(_ => CrossFirebaseAnalytics.Current);
            builder.Services.AddSingleton(_ => CrossFirebaseCrashlytics.Current);
    #endif
    
            return builder;
        }
    }
    

    MainPage.xaml

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="MauiApp2.MainPage">
        <VerticalStackLayout Padding="30" Spacing="20" VerticalOptions="Center">
            <Label Text="Firebase Test App" FontSize="Large" HorizontalOptions="Center" />
    
            <Button Text="Log Analytics Event" Clicked="OnLogEventClicked" />
    
            <Button Text="Force Test Crash (Crashlytics)"
                    Clicked="OnCrashClicked"
                    BackgroundColor="Red" TextColor="White" />
        </VerticalStackLayout>
    </ContentPage>
    

    This is MainPage.xaml.cs:

    using Plugin.Firebase.Analytics;
    using Plugin.Firebase.Crashlytics;
    
    namespace MauiApp2
    {
        public partial class MainPage : ContentPage
        {
            int count = 0;
    
            public MainPage()
            {
                InitializeComponent();
            }
    
            private void OnLogEventClicked(object sender, EventArgs e)
            {
                CrossFirebaseAnalytics.Current.LogEvent("test_button_clicked",
                    new Dictionary<string, object> { { "button", "analytics_test" } });
    
                DisplayAlert("Analytics", "Event sent to Firebase!", "OK");
            }
    
            private void OnCrashClicked(object sender, EventArgs e)
            {
                CrossFirebaseCrashlytics.Current.RecordException(new Exception("Test non-fatal exception"));
                throw new Exception("This is a deliberate test crash for Crashlytics");
            }
        }
    }
    
    

    My .csprj file:

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFrameworks>net10.0-android</TargetFrameworks>
        <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
    
        <!-- Note for MacCatalyst:
        The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
        When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
        The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
        either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
        <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
    
        <OutputType>Exe</OutputType>
        <RootNamespace>MauiApp2</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    
        <!-- Enable XAML source generation for faster build times and improved performance.
             This generates C# code from XAML at compile time instead of runtime inflation.
             To disable, remove this line.
             For individual files, you can override by setting Inflator metadata:
               <MauiXaml Update="MyPage.xaml" Inflator="Default" /> (reverts to defaults: Runtime for Debug, XamlC for Release)
               <MauiXaml Update="MyPage.xaml" Inflator="Runtime" /> (force runtime inflation) -->
        <MauiXamlInflator>SourceGen</MauiXamlInflator>
    
        <!-- Display name -->
        <ApplicationTitle>MauiApp2</ApplicationTitle>
    
        <!-- App Identifier -->
        <ApplicationId>com.companyname.mauiapp2</ApplicationId>
    
        <!-- Versions -->
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>
    
        <!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
        <WindowsPackageType>None</WindowsPackageType>
    
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
      </PropertyGroup>
    
      <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
    
        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
    
        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
    
        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />
    
        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
      </ItemGroup>
    
      <ItemGroup>
        <None Remove="Platforms\Android\Resources\values\strings.xml" />
      </ItemGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.Maui.Controls" Version="10.0.51" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.6" />
        <PackageReference Include="Plugin.Firebase" Version="4.0.0" />
        <PackageReference Include="Plugin.Firebase.Analytics" Version="4.0.0" />
        <PackageReference Include="Plugin.Firebase.Crashlytics" Version="4.0.0" />
      </ItemGroup>
    
      <ItemGroup Condition="'$(TargetFramework)' == 'net10.0-android'">
        <GoogleServicesJson Include="Platforms\Android\google-services.json" />
      </ItemGroup>
    
    </Project>
    

    After making all the changes, please clean and rebuild the project.

    • Click Log Analytics Event, then check the Analytics dashboard to see the result.
    • Click Force Test Crash, then restart the app and check the Crashlytics dashboard to see the crash report.

    image (1)

    image (2)

    image (3)

    image (4)

    image (5)

    I hope this helps. Please give it a try and let me know whether it works. Thank you for your patience.

    0 comments No comments

  2. Nancy Vo (WICLOUD CORPORATION) 2,655 Reputation points Microsoft External Staff Moderator
    2026-04-07T03:37:44.04+00:00

    Hi @Vignesh Palthurai ,

    Thanks for your question.

    In a normal Android app, Google’s Gradle tools automatically create that badge (the "build ID").

    But in .NET MAUI, we’re not using normal Gradle, we use the Plugin.Firebase wrapper. The plugin brings in the real Crashlytics detective, but it doesn’t automatically create the badge.

    I recommend some following steps:

    1. Create (or open) the strings.xml file.

    Go to this exact folder in your MAUI project: Platforms/Android/Resources/values/

    Inside that folder, create a new file called strings.xml (if it doesn’t already exist).

    1. Then, put this content inside strings.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="com.google.firebase.crashlytics.mapping_file_id">none</string>
        <!-- Optional safety line -->
        <string name="com.crashlytics.android.build_id">1.0</string>
    </resources>
    
    1. Set the Build Action correctly
    • Right-click the strings.xml file in Solution Explorer.
    • Choose Properties.
    • Set Build Action to AndroidResource (very important!).
    1. Clean + Rebuild + Run Clean the solution → Rebuild → Run on Android device/emulator.

    Make sure you initialize Firebase and enable Crashlytics in MauiProgram.cs. Add this code before builder.Build():

    // Check Plugin.Firebase docs for the exact method in your version.
    builder.ConfigureFirebase();
    
    CrossFirebaseCrashlytics.Current.SetCrashlyticsCollectionEnabled(true);
    

    If ConfigureFirebase() is not available, you can also try:

    CrossFirebase.Initialize();
    

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.