ComposeStackTraceMode

Class

Common
public value class ComposeStackTraceMode private constructor(private val value: Int)

Defines how Compose runtime collects stack traces after a crash. The stack trace mode is configured globally for all composition instances through androidx.compose.runtime.Composer.setDiagnosticStackTraceMode.

Companion Object

Properties

Common
public val None: ComposeStackTraceMode

No stack trace information will be collected.

Common
public val GroupKeys: ComposeStackTraceMode

Collects a stack trace with group keys. This stack trace can be deobfuscated with the proguard mapping that ships with the app (starting with Kotlin 2.3.0).

The group key stack traces are less precise than source information, but they do not add any runtime overhead until crash occurs and work with minified builds.

Example stack trace:

java.lang.IllegalStateException: <message>   at <original trace>
Suppressed: androidx.compose.runtime.ComposeTraceException:
Composition stack when thrown:   at $$compose.m$123(SourceFile:1)   at $$compose.m$234(SourceFile:1)   ...
Common
public val SourceInformation: ComposeStackTraceMode

Collects source information for stack trace purposes. When this flag is enabled, composition will record source information at runtime. When crash occurs, Compose will append a suppressed exception that contains a stack trace pointing to the place in composition closest to the crash.

Note that:

  • Recording source information introduces additional performance overhead, so this option should NOT be enabled in release builds that are not optimized with R8 (or equivalent).
  • Compose ships with a minifier config that removes source information from the release builds. Enabling this flag in minified builds will fallback in GroupKeys

Example stack trace:

java.lang.IllegalStateException: <message>   at <original trace>
Suppressed: androidx.compose.runtime.ComposeTraceException:
Composition stack when thrown:   at ReusableComposeNode(Composables.kt:359)   at Layout(Layout.kt:79)   at <lambda>(App.kt:164)   ...
Common
public val Auto: ComposeStackTraceMode

GroupKeys when app is minified, or None otherwise.