FirebaseCrashlytics

The Firebase Crashlytics API, mirroring com.google.firebase.crashlytics.FirebaseCrashlytics from the Firebase Android SDK: annotates and manages the fatal crashes, non-fatal errors and ANRs reported to Crashlytics.

Crashlytics is initialized automatically on every platform; getInstance (or Firebase.crashlytics) returns the singleton, which always belongs to the default com.google.firebase.FirebaseApp.

The Firebase Crashlytics API, mirroring com.google.firebase.crashlytics.FirebaseCrashlytics from the Firebase Android SDK: annotates and manages the fatal crashes, non-fatal errors and ANRs reported to Crashlytics.

Crashlytics is initialized automatically on every platform; getInstance (or Firebase.crashlytics) returns the singleton, which always belongs to the default com.google.firebase.FirebaseApp.

Types

Link copied to clipboard
actual object Companion
actual object Companion
expect object Companion

Properties

Link copied to clipboard
val ios: FIRCrashlytics

The underlying Firebase iOS SDK object.

Link copied to clipboard

Whether automatic data collection is enabled.

Whether automatic data collection is enabled.

Whether automatic data collection is enabled.

Functions

Link copied to clipboard

Whether there are unsent reports on the device. Only meaningful when automatic data collection is disabled: with it enabled the reports are sent as they are created and the task completes with false.

The iOS SDK only invokes the completion when automatic data collection is disabled (with it enabled, reports are sent at startup and there is nothing to check), so the task completes with false then, as on Android.

Whether there are unsent reports on the device. Only meaningful when automatic data collection is disabled: with it enabled the reports are sent as they are created and the task completes with false.

Link copied to clipboard
actual fun deleteUnsentReports()

If automatic data collection is disabled, queues all the reports on the device for deletion; otherwise a no-op.

actual fun deleteUnsentReports()

If automatic data collection is disabled, queues all the reports on the device for deletion; otherwise a no-op.

expect fun deleteUnsentReports()

If automatic data collection is disabled, queues all the reports on the device for deletion; otherwise a no-op.

Link copied to clipboard

Whether the app crashed during its previous run.

Whether the app crashed during its previous run.

Whether the app crashed during its previous run.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
actual fun log(message: String)

Logs a message that is included in the next fatal, non-fatal or ANR report. Newlines are stripped and long messages are truncated; the log is capped at 64 KB and rolls from the oldest message.

actual fun log(message: String)

Logs a message that is included in the next fatal, non-fatal or ANR report. Newlines are stripped and long messages are truncated; the log is capped at 64 KB and rolls from the oldest message.

expect fun log(message: String)

Logs a message that is included in the next fatal, non-fatal or ANR report. Newlines are stripped and long messages are truncated; the log is capped at 64 KB and rolls from the oldest message.

Link copied to clipboard
actual fun recordException(throwable: Throwable)

Records a non-fatal report with the exception's class, message and stack trace. On Apple platforms the stack frames are reported as code addresses of the Kotlin framework, which Crashlytics symbolicates from its dSYM; see Crashlytics on iOS in the README.

actual fun recordException(throwable: Throwable, keysAndValues: CustomKeysAndValues)

Records a non-fatal report with keysAndValues attached to the event, in addition to the app level custom keys; the event keys override app level keys of the same name. On Apple platforms, where the SDK has no per-event keys, they are logged as 🔑 key = value lines just before the event, so they show in its logs rather than its keys; see Crashlytics on iOS in the README.

actual fun recordException(throwable: Throwable)

Records the exception as a Crashlytics exception model: its class as the name, its message as the reason and its own stack frames as code addresses, which Crashlytics symbolicates from the Kotlin framework's dSYM, each cause following after a Caused by: frame. Recording an NSError instead would only capture the native stack of this call. See Crashlytics on iOS in the README.

actual fun recordException(throwable: Throwable, keysAndValues: CustomKeysAndValues)

Records the exception as recordException does, with the keys logged just before it as 🔑 key = value lines, so that they show in the event's logs. The iOS SDK takes per-event keys only on an NSError, which carries the native stack of the recording call instead of the exception's frames, and its custom keys are session state that the report carries as one final map, so neither attaches keys to a single event. See Crashlytics on iOS in the README.

expect fun recordException(throwable: Throwable)

Records a non-fatal report with the exception's class, message and stack trace. On Apple platforms the stack frames are reported as code addresses of the Kotlin framework, which Crashlytics symbolicates from its dSYM; see Crashlytics on iOS in the README.

expect fun recordException(throwable: Throwable, keysAndValues: CustomKeysAndValues)

Records a non-fatal report with keysAndValues attached to the event, in addition to the app level custom keys; the event keys override app level keys of the same name. On Apple platforms, where the SDK has no per-event keys, they are logged as 🔑 key = value lines just before the event, so they show in its logs rather than its keys; see Crashlytics on iOS in the README.

Link copied to clipboard

Records a non-fatal report with the custom keys set in init attached to the event; see KeyValueBuilder.

Records a non-fatal report with customKeys attached to the event; see CompatFirebaseCrashlytics.recordException. String, Boolean, Double, Float, Int and Long values keep their type, any other value is attached as its toString().

Link copied to clipboard
actual fun sendUnsentReports()

If automatic data collection is disabled, queues all the reports on the device to be sent; otherwise a no-op.

actual fun sendUnsentReports()

If automatic data collection is disabled, queues all the reports on the device to be sent; otherwise a no-op.

expect fun sendUnsentReports()

If automatic data collection is disabled, queues all the reports on the device to be sent; otherwise a no-op.

Link copied to clipboard

Enables or disables automatic data collection, overriding the manifest / plist settings and the Firebase-wide setting. Disabling it keeps reports on the device until sendUnsentReports or deleteUnsentReports is called.

Like setCrashlyticsCollectionEnabled with a Boolean, where null clears the override and falls back to the manifest and Firebase-wide settings on Android. Apple platforms have no override to clear, so null leaves the current setting unchanged there.

Enables or disables automatic data collection, overriding the manifest / plist settings and the Firebase-wide setting. Disabling it keeps reports on the device until sendUnsentReports or deleteUnsentReports is called.

null leaves the setting unchanged: the iOS SDK has no override to clear.

Enables or disables automatic data collection, overriding the manifest / plist settings and the Firebase-wide setting. Disabling it keeps reports on the device until sendUnsentReports or deleteUnsentReports is called.

Like setCrashlyticsCollectionEnabled with a Boolean, where null clears the override and falls back to the manifest and Firebase-wide settings on Android. Apple platforms have no override to clear, so null leaves the current setting unchanged there.

Link copied to clipboard
actual fun setCustomKey(key: String, value: Boolean)

Sets a custom key and value that are attached to subsequent reports; calling it again with the same key updates the value. At most 64 keys are kept, and keys or values over 1024 characters are truncated.

actual fun setCustomKey(key: String, value: Double)
actual fun setCustomKey(key: String, value: Float)
actual fun setCustomKey(key: String, value: Int)
actual fun setCustomKey(key: String, value: Long)
actual fun setCustomKey(key: String, value: String)
actual fun setCustomKey(key: String, value: Boolean)

Sets a custom key and value that are attached to subsequent reports; calling it again with the same key updates the value. At most 64 keys are kept, and keys or values over 1024 characters are truncated.

actual fun setCustomKey(key: String, value: Double)
actual fun setCustomKey(key: String, value: Float)
actual fun setCustomKey(key: String, value: Int)
actual fun setCustomKey(key: String, value: Long)
actual fun setCustomKey(key: String, value: String)
expect fun setCustomKey(key: String, value: Boolean)

Sets a custom key and value that are attached to subsequent reports; calling it again with the same key updates the value. At most 64 keys are kept, and keys or values over 1024 characters are truncated.

expect fun setCustomKey(key: String, value: Double)
expect fun setCustomKey(key: String, value: Float)
expect fun setCustomKey(key: String, value: Int)
expect fun setCustomKey(key: String, value: Long)
expect fun setCustomKey(key: String, value: String)
Link copied to clipboard
actual fun setCustomKeys(keysAndValues: CustomKeysAndValues)

Sets several custom keys at once; see setCustomKey for the limits.

actual fun setCustomKeys(keysAndValues: CustomKeysAndValues)

Sets several custom keys at once; see setCustomKey for the limits.

expect fun setCustomKeys(keysAndValues: CustomKeysAndValues)

Sets several custom keys at once; see setCustomKey for the limits.

Link copied to clipboard

Sets the custom keys given in init at once; see KeyValueBuilder and FirebaseCrashlytics.setCustomKeys.

Sets customKeys that are attached to subsequent reports; see CompatFirebaseCrashlytics.setCustomKeys. String, Boolean, Double, Float, Int and Long values keep their type, any other value is attached as its toString().

Link copied to clipboard
actual fun setUserId(identifier: String)

Records a user identifier that is attached to subsequent reports; identifiers over 1024 characters are truncated.

actual fun setUserId(identifier: String)

Records a user identifier that is attached to subsequent reports; identifiers over 1024 characters are truncated.

expect fun setUserId(identifier: String)

Records a user identifier that is attached to subsequent reports; identifiers over 1024 characters are truncated.

Link copied to clipboard
open override fun toString(): String