Reputation: 783
I did below steps to Set Up Firebase Crashlytics in my .NET MAUI app.
Created a new project in firebase console and added android and ios project. Downloaded the google-services.json
file and GoogleService-Info.plist
file and added it on the project. (I have already did this for push notification implementation)
Added Plugin.Firebase.Crashlytics
package.
Added below meta-data on AndroidManifest file.
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="true" />
Added below code on Android MainApplication
:
public override void OnCreate()
{
base.OnCreate();
FirebaseApp.InitializeApp(this);
}
Added below code on AppDelegate
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Firebase.Core.App.Configure();
return base.FinishedLaunching(app, options);
}
I did a test crash like below when click on a button:
private void TestSampleCrash(object sender, EventArgs e)
{
throw new Exception("Test crash for Firebase Crashlytics");
}
But it is not showing on firebase crashlytics console. Am I missing anything in this integration?
Current crash issue in FCM Console:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
at android.widget.Toast.<init>(Toast.java:118)
at android.widget.Toast.makeText(Toast.java:286)
at android.widget.Toast.makeText(Toast.java:276)
at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(MauiApplication.java)
at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1124)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5969)
at android.app.ActivityThread.-wrap1()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1774)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:6759)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:875)
Upvotes: 0
Views: 180
Reputation: 7990
Here is a similar issue on GitHub Firebase Crashlytics doesn't detect any bugs (NET 8) and you may try the workaround to add the PropertyGroup
in the project file.
For the configuration of Plugin.Firebase.Crashlytics
for MAUI, you can refer to the Plugin's documentation Crashlytics and set up the plugin.
The specific steps to set up for iOS or Android platform: Setup and its usage: Usage. You may also check the Sample.
Hope it helps!
Upvotes: 0