---
title: "Kotlin Compiler Plugin"
description: "Learn about using the Sentry Kotlin Compiler Plugin."
url: https://docs.sentry.io/platforms/android/enhance-errors/kotlin-compiler-plugin/
---

# Kotlin Compiler Plugin | Sentry for Android

The [Sentry Kotlin Compiler Plugin](https://github.com/getsentry/sentry-android-gradle-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.

* [View Hierarchy](https://docs.sentry.io/platforms/android/enriching-events/viewhierarchy.md)
* [User Interaction Tracing](https://docs.sentry.io/platforms/android/tracing/instrumentation/automatic-instrumentation.md#user-interaction-instrumentation)

The minimum supported Kotlin version is `1.8.20`.

## [How it works](https://docs.sentry.io/platforms/android/enhance-errors/kotlin-compiler-plugin.md#how-it-works)

Given a `@Composable` function:

```kotlin
@Composable
fun LoginScreen() {
    Column() {
        // ...
    }
}
```

The Sentry Kotlin Compiler Plugin will transform it into the following:

```kotlin
@Composable
fun LoginScreen() {
    Column(modifier = Modifier.sentryTag("LoginScreen")) {
        // ...
    }
}
```

## [Setup](https://docs.sentry.io/platforms/android/enhance-errors/kotlin-compiler-plugin.md#setup)

### [Install the Compiler Plugin](https://docs.sentry.io/platforms/android/enhance-errors/kotlin-compiler-plugin.md#install-the-compiler-plugin)

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`

```groovy
plugins {
  id "io.sentry.kotlin.compiler.gradle" version "6.4.0"
}
```

### [Add the Runtime Dependency](https://docs.sentry.io/platforms/android/enhance-errors/kotlin-compiler-plugin.md#add-the-runtime-dependency)

The runtime dependency is required as well, otherwise the Compiler Plugin will not be able to apply any changes. Add the following to *every* relevant `build.gradle` module. If you are using the Sentry Android Gradle Plugin, this is already done for you for the `app` module.

`app/build.gradle.kts`

```kotlin
implementation("io.sentry:sentry-compose-android:8.38.0")
```

### [Configuration](https://docs.sentry.io/platforms/android/enhance-errors/kotlin-compiler-plugin.md#configuration)

As of now no additional steps are necessary. Checkout the docs for [View Hierarchy](https://docs.sentry.io/platforms/android/enriching-events/viewhierarchy.md) and [User Interaction Tracing](https://docs.sentry.io/platforms/android/tracing/instrumentation/automatic-instrumentation.md#user-interaction-instrumentation) to see which features the Sentry Kotlin Compiler Plugin improves.
