6

I migrated to Firebase Crashlytics SDK. The debug app work's fine, the Crashlytics gets initialized and when there is a crash, after restarting the app it uploads the crashes to https://crashlyticsreports-pa.googleapis.com.

But when I create a release apk, the Crashlytics does get initialized but the logs do not get uploaded.

I am using com.google.firebase:firebase-crashlytics-gradle:2.3.0

Some logs after debugging:

10-14 17:47:42.803 10335 10723 D FirebaseCrashlytics: Executing shutdown hook for Crashlytics Exception Handler
10-14 17:47:42.804 10335 10724 D FirebaseCrashlytics: Executing shutdown hook for com.google.firebase.crashlytics.startup
10-14 17:47:42.808 10335 10725 D FirebaseCrashlytics: Executing shutdown hook for awaitEvenIfOnMainThread task continuation executor
10-14 17:47:50.523 10755 10755 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
10-14 17:47:50.523 10755 10755 D FirebaseCrashlytics: Firebase Analytics is available.
10-14 17:47:50.523 10755 10755 D FirebaseCrashlytics: Firebase Analytics listener registered successfully.
10-14 17:47:50.534 10755 10755 D FirebaseCrashlytics: Reading cached settings...
10-14 17:47:50.536 10755 10755 D FirebaseCrashlytics: Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"593f7256d634338f7a00010e","bundle_id":"com.myapp"},"expires_at":1602742343631}
10-14 17:47:50.536 10755 10755 D FirebaseCrashlytics: Returning cached settings.
10-14 17:47:50.537 10755 10755 D FirebaseCrashlytics: Mapping file ID is: 3f921f2e662f4b19a04a74d134464115d
10-14 17:47:50.537 10755 10755 I FirebaseCrashlytics: Initializing Crashlytics 17.2.2
10-14 17:47:50.538 10755 10755 D FirebaseCrashlytics: Installer package name is: null
10-14 17:47:50.564 10755 10755 D FirebaseCrashlytics: Exception handling initialization successful
10-14 17:47:50.607 10755 10782 D FirebaseCrashlytics: Found matching FID, using Crashlytics IID: 9b68e8c3d603455d8296cfe9e85d2de7
10-14 17:47:50.607 10755 10782 D FirebaseCrashlytics: Opening a new session with ID 5F869F160238-0001-2A03-9234AE8E16EA
10-14 17:47:50.621 10755 10782 D FirebaseCrashlytics: Initialization marker file created.
10-14 17:47:50.622 10755 10782 D FirebaseCrashlytics: Registered Firebase Analytics event receiver for breadcrumbs
10-14 17:47:50.622 10755 10782 D FirebaseCrashlytics: Finalizing previously open sessions.
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Closing open sessions.
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Closing session: 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Collecting session parts for ID 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Session 5F8697A600BB-0001-285F-9234AE8E16EA has fatal exception: false
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Session 5F8697A600BB-0001-285F-9234AE8E16EA has non-fatal exceptions: false
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: No events present for session ID 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Removing session part files for ID 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.629 10755 10782 D FirebaseCrashlytics: Finalizing report for session 5F8697A600BB0001285F9234AE8E16EA
10-14 17:47:50.630 10755 10782 D FirebaseCrashlytics: Session 5F8697A600BB0001285F9234AE8E16EA has no events.
10-14 17:47:50.631 10755 10782 D FirebaseCrashlytics: Closed all previously open sessions
10-14 17:47:50.631 10755 10782 D FirebaseCrashlytics: No reports are available.
10-14 17:47:50.631 10755 10782 D FirebaseCrashlytics: Initialization marker file removed: true
10-14 17:47:50.688 10755 10755 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.

When I did run the debug app with logs enabled I saw the crash that I invoked. Which I did not see when I ran the release apk.

10-14 18:04:14.162 11202 11202 D FirebaseCrashlytics: Crashlytics is handling uncaught exception "java.lang.RuntimeException: Testing....." from thread main

*** After lot of debugging I found out that if I have: ***

Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());

Then Crashes are not getting reported to Firebase. The same worked with Fabric though. Any idea how I should handle it?

Zoe
  • 27,060
  • 21
  • 118
  • 148
user2234
  • 1,282
  • 1
  • 21
  • 44
  • Have you maybe accidentally made crashlytics initialization only for debug variant? – Haris Oct 14 '20 at 06:24
  • We need not initialise the Firebase Crashlytics, it gets by default initlialised. Also, in logs I do see its getting initialised just does not upload crash logs – user2234 Oct 14 '20 at 06:34
  • Should my google-services.json in /debug and /app folder have client_info{} for both packages in each folder? I mean google-services.json in both the folders would be the same ? – user2234 Oct 14 '20 at 09:41
  • I think the right place to put google-service.json is inside app folder. If you put it inside debug folder it's only used for debug variant. – Haris Oct 14 '20 at 15:24
  • We would need to see the debug logs, can you please write in to Firebase Support https://firebase.google.com/support/troubleshooter/contact – Chintan Oct 14 '20 at 18:04
  • @Haris D: I have it in /app as well as /debug folder – user2234 Oct 14 '20 at 21:33

1 Answers1

5

Please remove the setDefaultUncaughtExceptionHandler from the code. going forward crashlytics will take care of handling crashes default.

michael
  • 4,053
  • 2
  • 12
  • 31