Saturday, May 18, 2024

Latest Posts

Jetpack Compose compiler transferring 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 accountable for growing the compiler and can work intently with JetBrains, our co-founders of the Kotlin Basis. The model of the Compose compiler now all the time matches the Kotlin model. The compiler model is due to this fact 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 kind secure API. The Compose Compiler Gradle plugin’s versioning matches Kotlin’s, and it’s accessible 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 model 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 degree Gradle file, add the plugin:

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

Then in modules that use Compose, apply the plugin:

plugins {
   // Current plugins

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

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

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

android { ... }

composeCompiler {
   enableStrongSkippingMode = true

You may at present straight referencing the Compose compiler in your construct setup, somewhat than utilizing AGP to use the compose compiler plugin. If that’s the case, observe that the maven artifacts may even 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.

Latest Posts

Stay in touch

To be updated with all the latest news, offers and special announcements.