Im trying to add flutter crashlytics to my app and have followed the official documentation and setup guides.
in my project level build.gradle
Ive added:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
}
and in my app level build.gradle
Ive added:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:17.5.0'
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
}
Then in my main()
Ive added the below:
FirebaseAnalytics analytics;
void main() async{
//below will ensure initializations happen before calling runApp()
WidgetsFlutterBinding.ensureInitialized();
// this is needed for all firebase stuff from August 27, initialize at top
await Firebase.initializeApp();
Admob.initialize();
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
// Pass all uncaught errors from the framework to Crashlytics.
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
runApp(MyApp());
}
And to force the crash to test, I used the below line in a onPressed
function on another screen in my app.
FirebaseCrashlytics.instance.crash();
This is the log on crash:
D/AndroidRuntime(19056): Shutting down VM
E/AndroidRuntime(19056): FATAL EXCEPTION: main
E/AndroidRuntime(19056): Process: com.my_company.my_app, PID: 19056
E/AndroidRuntime(19056): io.flutter.plugins.firebase.crashlytics.FirebaseCrashlyticsTestCrash: This is a test crash caused by calling .crash() in Dart.
E/AndroidRuntime(19056): at io.flutter.plugins.firebase.crashlytics.FlutterFirebaseCrashlyticsPlugin.lambda$crash$1(FlutterFirebaseCrashlyticsPlugin.java:81)
E/AndroidRuntime(19056): at io.flutter.plugins.firebase.crashlytics.-$$Lambda$FlutterFirebaseCrashlyticsPlugin$H0t0BleSpjDMVvqpx8Hy-ZKGwP8.run(Unknown Source:0)
E/AndroidRuntime(19056): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(19056): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(19056): at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(19056): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(19056): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19056): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(19056): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process (19056): Sending signal. PID: 19056 SIG: 9
Lost connection to device.
Which looks like it is crashing as expected but at the firebase website I am stuck at the following:
I know that the app has to restart to send the report and I have restarted my app many times after crash, but still nothing is received by firebase,
what am I doing wrong?