firebase-android-sdk: Crashlytics non-fatal uploads never send: Send to Reports Endpoint for non-native reports disabled. Removing Reports Uploader report.
[READ] Step 1: Are you in the right place?
Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:
- For general technical questions, post a question on StackOverflow with the firebase tag.
- For general Firebase discussion, use the firebase-talk google group.
- For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Android Studio version: 4.01
- Firebase Component: Crashlytics
- Component version: 17.2.1
- Android Version 7.0
[REQUIRED] Step 3: Describe the problem
FirebaseCrashlytics.getInstance().recordException(e)
records are not uploaded at app relaunch due to “Send to Reports Endpoint for non-native reports disabled.”
Steps to reproduce:
- Enable firebase verbose logging:
adb shell setprop log.tag.FirebaseCrashlytics VERBOSE
- Crash app via null reference produced by app
- After a delay (ensuring report is saved to disk) close and open the application.
- At relaunch report upload is rejected due to:
- This seems to originate at `firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/report/ReportUploader.java:114
Relevant Code:
Application
@Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
FirebaseApp.getInstance().setDataCollectionDefaultEnabled(new Boolean(true));
MainActivity
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyCustomExceptionHandler exceptionHandler = new MyCustomExceptionHandler(this);
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
FirebaseCrashlytics crashInstance = FirebaseCrashlytics.getInstance();
crashInstance.setUserId(<device_id>);
crashInstance.setCrashlyticsCollectionEnabled(true);
MyCustomExceptionHandler:
public class MyCustomExceptionHandler implements Thread.UncaughtExceptionHandler {
private Activity activity;
public MyCustomExceptionHandler(Activity activity){
this.activity = activity;
}
public void uncaughtException(final Thread t, final Throwable e) {
FirebaseCrashlytics.getInstance().recordException(e);
try{
Thread.sleep(10000);
} catch (InterruptedException ex){
this.activity.finish();
System.exit(2);
}
}
}
####Output Log
2020-09-09 10:56:39.910 23455-23478/<our_app> D/FirebaseCrashlytics: Crashlytics is logging non-fatal exception "java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference" from thread Thread-38
2020-09-09 10:56:39.951 23455-23478/<our_app> D/FirebaseCrashlytics: No log data to include with this event.
2020-09-09 10:56:39.966 23455-23478/<our_app> D/FirebaseCrashlytics: Crashlytics is logging non-fatal exception "java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference" from thread Thread-39
2020-09-09 10:56:39.976 23455-23478/<our_app> D/FirebaseCrashlytics: No log data to include with this event.
2020-09-09 10:56:49.872 23455-23649/<our_app> D/FirebaseCrashlytics: Executing shutdown hook for Crashlytics Exception Handler
2020-09-09 10:56:49.877 23455-23651/<our_app> D/FirebaseCrashlytics: Executing shutdown hook for awaitEvenIfOnMainThread task continuation executor
2020-09-09 10:56:49.878 23455-23650/<our_app> D/FirebaseCrashlytics: Executing shutdown hook for com.google.firebase.crashlytics.startup
2020-09-09 10:56:50.314 23652-23652/<our_app> D/FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
2020-09-09 10:56:50.315 23652-23652/<our_app> D/FirebaseCrashlytics: Firebase Analytics is available.
2020-09-09 10:56:50.321 23652-23652/<our_app> D/FirebaseCrashlytics: Firebase Analytics listener registered successfully.
2020-09-09 10:56:50.364 23652-23652/<our_app> D/FirebaseCrashlytics: Reading cached settings...
2020-09-09 10:56:50.384 23652-23652/<our_app> 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":true,"report_upload_variant":2,"native_report_upload_variant":1},"fabric":{"org_id":"5d10c8d02edc7f9d20001054","bundle_id":"<our_app>"},"expires_at":1599665515524}
2020-09-09 10:56:50.384 23652-23652/<our_app> D/FirebaseCrashlytics: Returning cached settings.
2020-09-09 10:56:50.390 23652-23652/<our_app> D/FirebaseCrashlytics: Mapping file ID is: 00000000000000000000000000000000
2020-09-09 10:56:50.392 23652-23652/<our_app> I/FirebaseCrashlytics: Initializing Crashlytics 17.2.1
2020-09-09 10:56:50.395 23652-23652/<our_app> D/FirebaseCrashlytics: Installer package name is: null
2020-09-09 10:56:50.510 23652-23652/<our_app> D/FirebaseCrashlytics: Exception handling initialization successful
2020-09-09 10:56:50.543 23652-23677/<our_app> D/FirebaseCrashlytics: Found matching FID, using Crashlytics IID: 0661ce2d631b408d8460037f59996b67
2020-09-09 10:56:50.545 23652-23677/<our_app> D/FirebaseCrashlytics: Opening a new session with ID 5F58ED32020C-0001-5C64-BF8AAF1C7061
2020-09-09 10:56:50.618 23652-23677/<our_app> D/FirebaseCrashlytics: Initialization marker file created.
2020-09-09 10:56:50.619 23652-23677/<our_app> D/FirebaseCrashlytics: Registered Firebase Analytics event receiver for breadcrumbs
2020-09-09 10:56:50.620 23652-23677/<our_app> D/FirebaseCrashlytics: Finalizing previously open sessions.
2020-09-09 10:56:50.655 23652-23677/<our_app> D/FirebaseCrashlytics: Closing open sessions.
2020-09-09 10:56:50.656 23652-23677/<our_app> D/FirebaseCrashlytics: Closing session: 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.656 23652-23677/<our_app> D/FirebaseCrashlytics: Collecting session parts for ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.659 23652-23677/<our_app> D/FirebaseCrashlytics: Session 5F58ED1402F0-0001-5B9F-BF8AAF1C7061 has fatal exception: false
2020-09-09 10:56:50.661 23652-23677/<our_app> D/FirebaseCrashlytics: Session 5F58ED1402F0-0001-5B9F-BF8AAF1C7061 has non-fatal exceptions: true
2020-09-09 10:56:50.662 23652-23677/<our_app> D/FirebaseCrashlytics: Collecting SessionStart data for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.683 23652-23677/<our_app> D/FirebaseCrashlytics: Collecting SessionUser data for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.686 23652-23677/<our_app> D/FirebaseCrashlytics: Collecting SessionApp data for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.691 23652-23677/<our_app> D/FirebaseCrashlytics: Collecting SessionOS data for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.692 23652-23677/<our_app> D/FirebaseCrashlytics: Collecting SessionDevice data for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.693 23652-23677/<our_app> D/FirebaseCrashlytics: Found Non Fatal for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061 in 5F58ED1402F0-0001-5B9F-BF8AAF1C7061SessionEvent0000000000.cls
2020-09-09 10:56:50.694 23652-23677/<our_app> D/FirebaseCrashlytics: Found Non Fatal for session ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061 in 5F58ED1402F0-0001-5B9F-BF8AAF1C7061SessionEvent0000000001.cls
2020-09-09 10:56:50.695 23652-23677/<our_app> D/FirebaseCrashlytics: Removing session part files for ID 5F58ED1402F0-0001-5B9F-BF8AAF1C7061
2020-09-09 10:56:50.749 23652-23677/<our_app> D/FirebaseCrashlytics: Closed all previously open sessions
2020-09-09 10:56:50.752 23652-23677/<our_app> D/FirebaseCrashlytics: Unsent reports are available.
2020-09-09 10:56:50.752 23652-23677/<our_app> D/FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
2020-09-09 10:56:50.753 23652-23677/<our_app> D/FirebaseCrashlytics: Automatic data collection is enabled. Allowing upload.
2020-09-09 10:56:50.758 23652-23677/<our_app> D/FirebaseCrashlytics: Initialization marker file removed: true
2020-09-09 10:56:51.325 23652-23679/<our_app> D/FirebaseCrashlytics: Server says an update is required - forcing a full App update.
2020-09-09 10:56:51.326 23652-23677/<our_app> D/FirebaseCrashlytics: Checking for crash reports...
2020-09-09 10:56:51.331 23652-23677/<our_app> D/FirebaseCrashlytics: Found crash report /data/user/0/<our_app>/files/.com.google.firebase.crashlytics/nonfatal-sessions/5F58ED1402F0-0001-5B9F-BF8AAF1C7061.cls
2020-09-09 10:56:51.332 23652-23677/<our_app> D/FirebaseCrashlytics: Reports are being sent.
2020-09-09 10:56:51.338 23652-23705/<our_app> D/FirebaseCrashlytics: Starting report processing in 1.0 second(s)...
2020-09-09 10:56:51.573 23652-23679/<our_app> D/FirebaseCrashlytics: Sending app info to https://update.crashlytics.com/spi/v1/platforms/android/apps/<our_app>
2020-09-09 10:56:51.621 23652-23677/<our_app> D/FirebaseCrashlytics: Crashlytics report successfully enqueued to DataTransport: 5F58ED1402F000015B9FBF8AAF1C7061
2020-09-09 10:56:51.622 23652-23652/<our_app> D/FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
2020-09-09 10:56:52.045 23652-23678/<our_app> D/FirebaseCrashlytics: Received Analytics message: 3 Bundle[{params=Bundle[{_o=auto, _sc=LauncherActivity, _si=-7144237981223821230}], name=_vs, timestampInMillis=1599663411770}]
2020-09-09 10:56:52.184 23652-23679/<our_app> D/FirebaseCrashlytics: Update app request ID: 02e3f5d10e8ef07398abdec06be7ee23
2020-09-09 10:56:52.185 23652-23679/<our_app> D/FirebaseCrashlytics: Result was 204
2020-09-09 10:56:52.339 23652-23705/<our_app> D/FirebaseCrashlytics: Attempting to send 1 report(s)
2020-09-09 10:56:52.339 23652-23705/<our_app> D/FirebaseCrashlytics: Send to Reports Endpoint for non-native reports disabled. Removing Reports Uploader report.
2020-09-09 10:56:52.340 23652-23705/<our_app> D/FirebaseCrashlytics: Removing report at /data/user/0/<our_app>/files/.com.google.firebase.crashlytics/nonfatal-sessions/5F58ED1402F0-0001-5B9F-BF8AAF1C7061.cls
2020-09-09 10:56:53.635 23652-23678/<our_app> D/FirebaseCrashlytics: Received Analytics message: 3 Bundle[{params=Bundle[{_o=auto, _pc=LauncherActivity, _pi=-7144237981223821230, _sc=MainActivity, _si=2070087239120173802}], name=_vs, timestampInMillis=1599663413502}]
2020-09-09 10:56:57.428 23652-23678/<our_app> D/FirebaseCrashlytics: Received Analytics message: 3 Bundle[{params=Bundle[{_o=auto, _pc=MainActivity, _pi=2070087239120173802, _sc=LauncherActivity, _si=2070087239120173803}], name=_vs, timestampInMillis=1599663416888}]
2020-09-09 10:56:59.250 23652-23678/<our_app> D/FirebaseCrashlytics: Received Analytics message: 3 Bundle[{params=Bundle[{_o=auto, _et=2686, _sc=MainActivity, _si=2070087239120173802}], name=_e, timestampInMillis=1599663416586}]
2020-09-09 10:56:59.614 23652-23678/<our_app> D/FirebaseCrashlytics: Received Analytics message: 3 Bundle[{params=Bundle[{_o=auto, _pc=LauncherActivity, _pi=2070087239120173803, _sc=MainActivity, _si=2070087239120173802}], name=_vs, timestampInMillis=1599663419331}]
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 19 (7 by maintainers)
@alex-pathspot
Fortunately it doesn’t raise a
RuntimeException
, but simply returns control to the whicheverUncaughtExceptionHandler
was installed before it. This is usually the system default handler, which is what kills the app process. However, if you override the system default handler before Crashlytics starts up (viaThread.setDefaultUncaughtExceptionHandler
), Crashlytics will then hand control back to your custom handler instead of the system default. 😄You can do that a few different ways, but the simplest is probably to implement your own
ContentProvider
(similar to FirebaseInitProvider) which instruments your post-processing code, and set thatContentProvider
to run before Firebase’s by setting itsinitOrder
in yourAndroidManifest.xml
to a value > 100 (here’s theFirebaseInitProvider
AndroidManifest.xml for reference).Here’s an example
onCreate
in aContentProvider
that restarts my app after a crash:And the
AndroidManifest.xml
entry for it:Alternatively, you could also disable Firebase’s automatic initialization, then instrument your own exception handler before calling
FirebaseApp.initializeApp()
to initialize Firebase (and Crashlytics) manually as part of your app startup.@Fintasys, @tiny0Xy9 regarding your custom exception handling (
MyUncaughtExceptionHandler
):As long as you get a reference to the Crashlytics handler (by calling
Thread.getDefaultUncaughtExceptionHandler()
before setting your own) and then your exception handler callscrashlyticsHandler.uncaughtException(thread, exception);
after doing what it needs to do, crashes should be reported. Is that not what you’re seeing?@mrwillis21
My code also does not send a crash report if I do the following.
If you remove this code, the crash will be reported successfully.
@mrwillis21 Thanks for your answer. We tried to follow what you have said and we could see crashes being reported after switching the order of calling ExceptionHandler and enable firebase (disabled by default in Manifest) in Application
OnCreate
: Before:After:
We will do more tests, but so far it looks promising. Crashlytics version
17.1.0
We have the same issue and after removing
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler)
it start sending the logs again. We would like to keep it, so this is not a solution for us either.Crashlytics 17.2.2
I have been seeing the same thing, some reports come through and others do not even when forcing a crash in the same manner. I was able to get 9 crashes to show in Firebase this morning and now back to nothing… we are also migrating from Fabric over to Firebase Crashlytics due to the November deadline. Any update on this @alex-pathspot ?