Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

FirebaseApp is not initialized on real devices

Hello! I'm trying to add push notifications in Xamarin.Forms.
On Genymotion it's work fine but on real devices i have an error:
Default FirebaseApp is not initialized.Make shure to call FirebaseApp.initializeApp(Context)

google-services.json is present in Android project with GoogleServicesJson BuildAction

My MainActivity:

     public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
            internal static MainActivity Instance { get; private set; }
            internal static FirebaseInstanceId FirebaseInstance { get; private set; }

            public static int CurrentUserId { get; set; }
            protected override async void OnCreate(Bundle bundle)

                TabLayoutResource = Resource.Layout.Tabbar;
                ToolbarResource = Resource.Layout.Toolbar;

                global::Xamarin.Forms.Forms.Init(this, bundle);
                string dbPath = FileAccessHelper.GetLocalFilePath("LocalDataBase.db");

                LoadApplication(new App());


            //on real devices it return  null
                var app = Firebase.FirebaseApp.InitializeApp(this.ApplicationContext);

                Instance = this;


  • AnatoliyTkachenkoAnatoliyTkachenko USMember ✭✭

    Do i need to create Application class that extends Application and call Firebase.FirebaseApp.InitializeApp(this.ApplicationContext) in that class?

  • AnatoliyTkachenkoAnatoliyTkachenko USMember ✭✭
        Java.Lang.IllegalStateException: Default FirebaseApp is not initialized in this process Make sure to call FirebaseApp.initializeApp(Context) first.
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fcbf47a04b2e4d90beafbae627e1fca4>:0 
          at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method) [0x00068] in <dcbf64ae8f9943dcab345b6fa6378854>:0 
          at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod) [0x0000e] in <303b75409d4e4a17bc65607d320bb98e>:0 
          at Firebase.Iid.FirebaseInstanceId.get_Instance () [0x00032] in <09a4f89addb34f02af055f39e6c540b7>:0 
          at Rel_002.Droid.FirebaseCloudMessaging+<AddOrUpdateTokenAsync>d__2.MoveNext () [0x0005e] in E:\Projects\Rel_002\Rel_002\Rel_002.Android\FirebaseCloudMessaging.cs:73 
          --- End of managed Java.Lang.IllegalStateException stack trace ---
        java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process Make sure to call FirebaseApp.initializeApp(Context) first.
            at Source)
            at Source)
            at Method)
            at android.os.Handler.handleCallback(
            at android.os.Handler.dispatchMessage(
            at android.os.Looper.loop(
            at java.lang.reflect.Method.invoke(Native Method)
  • AnatoliyTkachenkoAnatoliyTkachenko USMember ✭✭

    Worked after downgrade NuGet Xamari.Firebase.Messaging to 42.1001.0

  • Alwin.5974Alwin.5974 USMember ✭✭

    In my case the Firebase app not initialized until I cleaned the solution and re-ran then all worked fine (VS2017, Firebase v60).

    Google-services.json was pulled in fine (without using the options builder as above) and I had no need to call FirebaseApp.InitializeApp manually (apparently this is done automatically whenever registration is required).

  • TiagovilaTiagovila USMember

    In my case I had the package name different between my application and my firebase project. So I created another project with the correct package name and downloaded the google-services.json again and put into my application.

  • ixmliamixmliam Member

    In my case adding "using Firebase;" to the MainActivity works for me

  • saad94saad94 Member

    I have the same issue, Rebuild my project solved the issue.

  • DavidHedelinDavidHedelin USMember ✭✭
    edited April 2020

    Add this Nuget package in the Android project: Xamarin.GooglePlayServices.Basement. After that package has been installed, you will be able to choose the GoogleServicesJson in the build action.

  • MarcoSalvatoriMarcoSalvatori USMember ✭✭✭

    @ThomasLoidolt said:

    I had the same problem and after some investigation I've tried to initiate it manually in that way

    var options = new FirebaseOptions.Builder()
    var fapp = FirebaseApp.InitializeApp(this, options);


          PushNotificationManager.ProcessIntent(this, Intent);

    That worked for me and it seems that the build process "GoogleServiceJson" doesn't work which should does it instead.

    Best regards,


    work for me.
    at any moment, he no longer compiled the google-services file

  • YuriMeiburgYuriMeiburg USMember

    I had the same issue, somehow I had to manually add Xamarin.Firebase.Messaging. to my Nuget packages. The plugin has a dependency but did not properly download it.

  • After two days of troubleshooting, finally i found out that the latest versions of the below nuget packages (or may be one of them) is causing this. I downgraded to the below versions and it started working.

    Xamarin.Azure.NotificationHubs.Android -> v0.6.0
    Xamarin.Firebase.Messaging -> v71.1740.0
    Xamarin.GooglePlayServices.Base -> v71.1610.0
  • FrankSzendzielarzFrankSzendzielarz CZMember ✭✭

    I hit this problem and nothing seemed to help. In the end it turned out this was the root issue:

Sign In or Register to comment.