bugfixes-kotlin

Android error reporting for Kotlin apps, minSdk 24. Captures uncaught JVM exceptions and reports ANRs and native crashes from system exit records on Android 11+. Pending reports wait on disk, up to 50.

Install

dependencies {
    implementation("es.bugfix:bugfixes-kotlin:0.1.0")
}

Create a mobile key

Create an agent in your project. From its public-key menu, choose Mobile key and allow your Android package name, such as com.example.app. Use the resulting bfm_ public key below. Never ship an agent secret in your app. An empty key disables reporting.

Start reporting

Initialize once in Application.onCreate(). The library declares the INTERNET permission.

import android.app.Application
import es.bugfix.client.BugfixesClient

class App : Application() {
    lateinit var bugfixes: BugfixesClient

    override fun onCreate() {
        super.onCreate()
        bugfixes = BugfixesClient.builder()
            .key("bfm_your_public_key")
            .environment("production")
            .build(this)
    }
}

Register this Application class in your Android manifest. You can supply the public key through BuildConfig.

Errors and logs

import es.bugfix.client.Level

bugfixes.report(IllegalStateException("Invalid inventory state"))
bugfixes.log(Level.ERROR, "Payment declined")

The default log threshold is ERROR. Set level(Level.INFO) on the builder to include routine logs. Release defaults to the app version and build; release() overrides it. JVM crashes are sent on the next launch. Pending requests retry with the next report or launch. Native crash descriptions do not include parsed tombstones, and R8-obfuscated stacks need mapping support to become readable.