KFirebaseCrashlytics

Enables seamless integration with Firebase Crashlytics, tracking user events, monitoring app performance, and gaining insights into user behavior through a unified API.

Android
iOS
watchOS
tvOS
GitHub stars1
Dependents0
Creation dateover 1 year ago

Last activity5 months ago
Latest release3.0.0 (5 months ago)

KFirebaseCrashlytics



KFirebaseCrashlytics is a Kotlin Multiplatform Mobile (KMM) package designed to provide seamless integration with Firebase Crashlytics across both Android and iOS platforms. This package allows developers to easily track user events, monitor app performance, and gain insights into user behavior through a unified API, without duplicating code for each platform


Maven Central

KFirebaseCrashlytics is available on mavenCentral().

  • Note add permissions notification needed android and ios

Version Compatibility

KFirebaseCrashlytics Version Firebase iOS SDK Minimum iOS Version
1.1.2 Firebase v11.x iOS 13+
2.0.0 Firebase v12.x iOS 15+

Installation

commonMain.dependencies {
    implementation("io.github.the-best-is-best:kfirebase-crashlytics:2.1.0")
    ...
}
appleMain.dependencies{
    api("io.github.the-best-is-best:kfirebase-crashlytics:1.1.1")

}
 listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
            export("io.github.the-best-is-best:kfirebase-crashlytics:2.0.0") //  need this
        }
    }

iOS (Using Swift Package Manager - SPM)

Make sure to add Firebase as a dependency using Swift Package Manager (SPM).

  1. Open your Xcode project.
  2. Navigate to File > Add Packages....
  3. Enter Firebase repository URL: https://github.com/firebase/firebase-ios-sdk
  4. Choose FirebaseCrashlytics and add it to your project.

💡 Pro Tip: Better iOS Crash Reports

By default, Kotlin exceptions on iOS can be hard to read in the Firebase Console. We highly recommend using NSExceptionKt alongside this package to get clear, readable Kotlin stack traces.

First in ios

 FirebaseApp.configure()
        KFirebaseCrashlyticsInit.shared.doInitCrashlytics()
    ...

Second in android

    AndroidKFirebaseCore.initialization(this)
    AndroidKFirebaseCrashlytics.init()

Example code

Can use https://crashkios.touchlab.co/docs/crashlytics CrashKiOS

 ElevatedButton(
                onClick = {
                    CrashlyticsKotlin.sendHandledException(Exception("kotlin exception"))
                }
            )
            {
                Text("Record Exception with crashlytics iso")
            }

            ...

API

expect class KFirebaseCrashlytics() {
    fun log(message: String)
    fun recordException(throwable: Throwable)
    fun trackHandledException(throwable: Throwable)
    fun setUserId(userId: String)
    fun setCustomKey(key: String, value: String)
    fun setCustomKey(key: String, value: Boolean)
    fun setCustomKey(key: String, value: Double)
    fun setCustomKey(key: String, value: Float)
    fun setCustomKey(key: String, value: Int)
    fun setCustomKey(key: String, value: Long)
    fun setCustomKeys(customKeys: Map<String, Any>)
    fun setCrashlyticsCollectionEnabled(enabled: Boolean)
    fun didCrashOnPreviousExecution(): Boolean
    fun sendUnsentReports()
    fun deleteUnsentReports()
}
Android
iOS
watchOS
tvOS
GitHub stars1
Dependents0
Creation dateover 1 year ago

Last activity5 months ago
Latest release3.0.0 (5 months ago)

KFirebaseCrashlytics



KFirebaseCrashlytics is a Kotlin Multiplatform Mobile (KMM) package designed to provide seamless integration with Firebase Crashlytics across both Android and iOS platforms. This package allows developers to easily track user events, monitor app performance, and gain insights into user behavior through a unified API, without duplicating code for each platform


Maven Central

KFirebaseCrashlytics is available on mavenCentral().

  • Note add permissions notification needed android and ios

Version Compatibility

KFirebaseCrashlytics Version Firebase iOS SDK Minimum iOS Version
1.1.2 Firebase v11.x iOS 13+
2.0.0 Firebase v12.x iOS 15+

Installation

commonMain.dependencies {
    implementation("io.github.the-best-is-best:kfirebase-crashlytics:2.1.0")
    ...
}
appleMain.dependencies{
    api("io.github.the-best-is-best:kfirebase-crashlytics:1.1.1")

}
 listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
            export("io.github.the-best-is-best:kfirebase-crashlytics:2.0.0") //  need this
        }
    }

iOS (Using Swift Package Manager - SPM)

Make sure to add Firebase as a dependency using Swift Package Manager (SPM).

  1. Open your Xcode project.
  2. Navigate to File > Add Packages....
  3. Enter Firebase repository URL: https://github.com/firebase/firebase-ios-sdk
  4. Choose FirebaseCrashlytics and add it to your project.

💡 Pro Tip: Better iOS Crash Reports

By default, Kotlin exceptions on iOS can be hard to read in the Firebase Console. We highly recommend using NSExceptionKt alongside this package to get clear, readable Kotlin stack traces.

First in ios

 FirebaseApp.configure()
        KFirebaseCrashlyticsInit.shared.doInitCrashlytics()
    ...

Second in android

    AndroidKFirebaseCore.initialization(this)
    AndroidKFirebaseCrashlytics.init()

Example code

Can use https://crashkios.touchlab.co/docs/crashlytics CrashKiOS

 ElevatedButton(
                onClick = {
                    CrashlyticsKotlin.sendHandledException(Exception("kotlin exception"))
                }
            )
            {
                Text("Record Exception with crashlytics iso")
            }

            ...

API

expect class KFirebaseCrashlytics() {
    fun log(message: String)
    fun recordException(throwable: Throwable)
    fun trackHandledException(throwable: Throwable)
    fun setUserId(userId: String)
    fun setCustomKey(key: String, value: String)
    fun setCustomKey(key: String, value: Boolean)
    fun setCustomKey(key: String, value: Double)
    fun setCustomKey(key: String, value: Float)
    fun setCustomKey(key: String, value: Int)
    fun setCustomKey(key: String, value: Long)
    fun setCustomKeys(customKeys: Map<String, Any>)
    fun setCrashlyticsCollectionEnabled(enabled: Boolean)
    fun didCrashOnPreviousExecution(): Boolean
    fun sendUnsentReports()
    fun deleteUnsentReports()
}