Jetpack Compose compiler shifting to the Kotlin repository

Posted by Ben Trengrove – Developer Relations Engineer, Nick Butcher – Product Supervisor for Jetpack Compose

We’re excited to announce that with the upcoming launch of Kotlin 2.0, the Jetpack Compose compiler will transfer to the Kotlin repository. Because of this an identical Compose compiler will launch alongside every launch of Kotlin. You’ll not have to attend for an identical Compose compiler launch earlier than upgrading the Kotlin model in your Compose app. The Compose group at Google will proceed to be chargeable for growing the compiler and can work carefully with JetBrains, our co-founders of the Kotlin Foundation. The model of the Compose compiler now at all times matches the Kotlin model. The compiler model is subsequently leaping to 2.0.0.

To simplify the arrange of Compose, we’re additionally releasing a brand new Compose Compiler Gradle plugin which helps you to configure the Compose compiler with a sort protected API. The Compose Compiler Gradle plugin’s versioning matches Kotlin’s, and it’s obtainable from Kotlin 2.0.0.

Emigrate to the brand new plugin, add the Compose Compiler Gradle plugin dependency to the plugins part of your Gradle version catalog:

kotlin = "2.0.0"

org-jetbrains-kotlin-android = { id = "", model.ref = "kotlin" }

// Add the Compose Compiler Gradle plugin, the model matches the Kotlin plugin
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", model.ref = "kotlin" }

In your mission’s root stage Gradle file, add the plugin:

plugins {
   // Present plugins 
   alias(libs.plugins.compose.compiler) apply false

Then in modules that use Compose, apply the plugin:

plugins {
   // Present plugins

The kotlinCompilerExtensionVersion is not required to be configured in composeOptions and could be eliminated.

composeOptions {
   kotlinCompilerExtensionVersion = libs.variations.compose.compiler.get()

If required, now you can add a high stage part to the identical Gradle file to configure choices for the Compose compiler.

android { ... }

composeCompiler {
   enableStrongSkippingMode = true

You may at the moment straight referencing the Compose compiler in your construct setup, moderately than utilizing AGP to use the compose compiler plugin. If that’s the case, observe that the maven artifacts may also change:







For an instance of this migration, see this pull request.

For extra info on migrating to the brand new Compose compiler artifact, together with directions for non-version catalog setups, see our up to date documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *