Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Exception Using Firebase in Xamarin Android

Java.Lang.IllegalStateException: Default FirebaseApp is not initialized in this process TestChartApp.TestChartApp. Make sure to call FirebaseApp.initializeApp(Context) first.

this is my code i am using

FirebaseApp.InitializeApp(this);

try
    {
        throw new NotImplementedException();
    }
    catch (System.Exception ex)
    {   
    FirebaseCrash.Report(ex);
    }

I am new to implement firebase crash reporting i am trying to implement crash report but it is throwing an error. please help me how can i solve that.

like image 374
Srinivas Ch Avatar asked Feb 10 '17 11:02

Srinivas Ch


3 Answers

Review your logcat output for FirebaseInitProvider tags, if you are getting:

[FirebaseInitProvider] FirebaseApp initialization unsuccessful

Then the two major things to check:

  • Make sure that your google-services.json is assigned a build action of GoogleServicesJson

  • Check that your application package name matches the one that you assigned in the Google Dev. Console

A successful FirebaseApp registration will result in the following logcat:

FirebaseInitProvider: FirebaseApp initialization successful

like image 192
SushiHangover Avatar answered Oct 21 '22 17:10

SushiHangover


After assigned the build action as GoogleServicesJson its working.

like image 4
Srinivas Ch Avatar answered Oct 21 '22 15:10

Srinivas Ch


Try entering the following in MainActivity.cs after the LoadApplication call.

FirebaseApp app = FirebaseApp.InitializeApp(Android.App.Application.Context);
like image 3
Novjean Avatar answered Oct 21 '22 17:10

Novjean