DavidSon Nguyen
DavidSon Nguyen

Reputation: 36

Tracking data with crashlytics Android

Sometimes, my application has errors due to wrong data. How can I know the details of that data when the application crashed with Crashlytics?

Upvotes: 0

Views: 885

Answers (2)

Basi
Basi

Reputation: 3158

If you initialized Firebase Crashlytics

when the application crashed all logcat information regarding crash uploaded to Firebase console

enter image description here

for customize your log

  • Crash report and Log.println:

    Crashlytics.log(Log.DEBUG, "tag", "message");

  • Crash report only:

    Crashlytics.log("message");

In addition to automatically reporting your app’s crashes, Crashlytics lets you log non-fatal exceptions.

try {
   methodThatThrows();
} catch (Exception e) {
   Crashlytics.logException(e);
// handle your exception here
 }

All logged exceptions appear as non-fatal issues in the Firebase console

codelabs

Upvotes: 1

Ben Luk
Ben Luk

Reputation: 755

Step1: Add Firebase to Your Android Project

https://firebase.google.com/docs/android/setup

https://firebase.google.com/docs/crashlytics/get-started#android

Step2: you can log caught exceptions in your app’s catch blocks:

try {
    methodThatThrows();
} catch (Exception e) {
    Crashlytics.logException(e);
    // handle your exception here
}

or

Step2: just call

Crashlytics.log(Log.DEBUG, "tag", "message");

https://firebase.google.com/docs/crashlytics/customize-crash-reports#log_non-fatal_exceptions

after that, you are able to get your logs in firebase console

Upvotes: 1

Related Questions