Skip to content

Crash Reporting

Crashes are captured as soon as the SDK starts. There's nothing to set up beyond initialization.

What's captured

  • Crashes: any uncaught Kotlin or Java exception, on any thread, with its full stack trace and the name of the thread it happened on.
  • Native crashes: crashes in native (C/C++) code, reported by Android itself on Android 11 (API 30) and higher.
  • Handled exceptions: errors you catch and report with Codeskop.recordException.

How a crash reaches you

  1. When an uncaught exception is about to end the process, the SDK saves it to the on-device queue. It waits for that write to finish, so the crash is on disk before the app dies.
  2. It then hands the exception to the crash handler that was already installed, so Android and any other crash tool behave exactly as before.
  3. The crash is uploaded at the next sync, usually after the user reopens the app and has a connection.

Native crashes work differently. Android records why the process ended, and on the next launch the SDK reads that record and reports it. Each crash is reported once. Native crashes include Android's description of the exit, but no Kotlin stack trace.

Handled exceptions

Report errors you recover from, so you can see how often they happen:

Kotlin
import com.codeskop.sdk.core.Codeskop try {    checkout.submit(order)} catch (e: PaymentException) {    Codeskop.recordException(e)   // reported as a handled exception    showRetry()}

recordException never throws. You don't need to wrap it in your own try/catch.

Context attached to every crash

  • Device model, manufacturer, Android version, locale and screen size
  • App package name, version name, version code, and whether it's a debug or release build
  • The user, if you've called identify, or the anonymous install ID if not
  • The SDK version

Exception messages are redacted by default

Exception messages often contain user input or personal data, so they're replaced with [REDACTED] before they leave the device. You still get the exception class and the full stack trace, which is what grouping and debugging rely on. If your messages are safe to collect, turn them on with captureExceptionMessages.

Exception messages

By default, every SDK sends the exception class and stack trace, and replaces the message with [REDACTED]. Set captureExceptionMessages to true to send the message as it is. It applies to crashes, uncaught errors and the exceptions you report yourself. It's off by default, and it's set in code, not in the dashboard.

Messages can contain user data

A message is whatever the code that threw it put there: an email address, an order number, a file path, the text someone typed. Turn this on only if your messages don't carry personal data, or if your privacy policy covers sending it.

The message is often the most useful clue (“cart is empty”, “database is locked”), so many teams turn it on. Request bodies, credential headers and URL query strings stay out either way.

Android

Pass it to CodeskopConfig (0.2.0+):

MyApplication.kt
CodeskopAndroid.init(    this,    CodeskopConfig(        apiKey = BuildConfig.CODESKOP_KEY,        captureExceptionMessages = true,   // send messages instead of [REDACTED]    ),)

If you initialize from the manifest instead of code, add this inside <application>:

AndroidManifest.xml
<meta-data    android:name="codeskop.capture_exception_messages"    android:value="true" />

iOS and Kotlin Multiplatform

From Swift, set captureExceptionMessages: true in the config you pass to start. The other values are the defaults, as on the Kotlin Multiplatform & iOS page:

AppDelegate.swift
import CodeskopSDK // Swift needs every CodeskopConfig parameter spelled outlet config = CodeskopConfig(    apiKey: "cs_live_pk_xxx",    endpoint: "https://api.codeskop.com",    environment: "production",    sampleRates: [:],    captureNetwork: true,    captureHeaders: true,    captureBodies: false,    redactHeaders: ["authorization", "cookie", "set-cookie"],    redactQueryKeys: ["token", "apikey", "password", "secret"],    maxQueueMb: 10,    heartbeatEnabled: true,    flushBatchSize: 50,    captureExceptionMessages: true,   // send messages instead of [REDACTED]    captureScreens: true)CodeskopIos.shared.start(config: config)

On the Android side of a Kotlin Multiplatform app, it's the same field:

androidMain
// androidMainCodeskopAndroid.init(    context,    CodeskopConfig(        apiKey = BuildConfig.CODESKOP_KEY,        captureExceptionMessages = true,    ),)

Flutter

Pass it to Codeskop.init (0.3.1+). It applies to Dart errors and native crashes:

lib/main.dart
void main() {  Codeskop.runGuarded(() async {    await Codeskop.init(      apiKey: 'cs_live_pk_YOUR_KEY',      endpoint: 'https://api.codeskop.com',      captureExceptionMessages: true,    );    runApp(const MyApp());  });}

Web

Pass it to init (1.6.0+). Errors from failed images, scripts and stylesheets include the file's URL without its query string.

main.ts
import { init } from "@codeskop/tracker"; init({  apiKey: "cs_live_pk_YOUR_KEY",  captureExceptionMessages: true, // send messages instead of [REDACTED]});

With the script tag, add the attribute:

index.html
<script src="https://cdn.jsdelivr.net/npm/@codeskop/tracker@1/dist/codeskop.min.js"        data-codeskop-key="cs_live_pk_…"        data-codeskop-exception-messages="true"></script>

Check that it works

  1. Ship the change to a test build with your cs_test_pk_… key.
  2. Cause or report an error with a message you'll recognize, for example with recordException.
  3. Open the issue in the dashboard after the next sync. The new event shows the message instead of [REDACTED].

Events sent before the change keep [REDACTED]. If the message is still redacted, check that the build you're testing has the new config and, on web, that the SDK is 1.6.0 or later.

Reliability guarantees

  • Never sampled. Crashes are kept whatever sampling rates you set.
  • Never dropped for space. If the queue fills up, older low-priority events are removed first. Crashes stay.
  • Survive being offline. Crashes wait on the device until there's a connection.

Using Codeskop with other crash tools

Codeskop chains onto whatever uncaught-exception handler was installed before it, and always passes the crash along. Tools such as Firebase Crashlytics keep working. Codeskop never swallows a crash and never stops your app from terminating.

Next steps