Kotlin Compiler Plugin
Learn about using the Sentry Kotlin Compiler Plugin.
The Sentry Kotlin Compiler Plugin is an addition to the Sentry Android Gradle plugin and offers improvements to existing SDK features. As of now the main focus of the plugin is to improve apps which utilize Jetpack Compose by automatically tagging @Composable
functions.
The minimum supported Kotlin version is 1.8.20
.
Given a @Composable
function:
@Composable
fun LoginScreen() {
Column() {
// ...
}
}
The Sentry Kotlin Compiler Plugin will transform it into the following:
@Composable
fun LoginScreen() {
Column(modifier = Modifier.sentryTag("LoginScreen")) {
// ...
}
}
Kotlin Compiler plugins are executed during compilation and thus need to be applied to every relevant Gradle module. Add the following to e.g. your app/build.gradle
:
app/build.gradle
plugins {
id "io.sentry.kotlin.compiler.gradle" version "4.14.1"
}
As of now no additional steps are necessary. Checkout the docs for View Hierarchy and User Interaction Tracing to see which features the Sentry Kotlin Compiler Plugin improves.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").