Compose Compiler Gradle Plugin - Jetpack Compose - Android Developers
Compose Compiler Gradle Plugin - Jetpack Compose - Android Developers
plugin
For Gradle users, you can use the Compose Compiler Gradle plugin to make setting up
and configuring Compose easier.
Note: The Compose Compiler Gradle Plugin is only available from Kotlin 2.0+. For migration
instructions, see "Jetpack Compose compiler moving to the Kotlin repository"
(https://android-developers.googleblog.com/2024/04/jetpack-compose-compiler-moving-to-kotlin-
repository.html)
. For an example migration, see the Compose Samples PR
(https://github.com/android/compose-samples/pull/1354) in the Compose samples.
[versions]
kotlin = "2.0.0"
[plugins]
org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version
1. In your projects root build.gradle.kts file, add the following to the plugins
section:
plugins {
// Existing plugins
alias(libs.plugins.compose.compiler) apply false
}
plugins {
// Existing plugins
alias(libs.plugins.compose.compiler)
}
Your app should now build and compile if you are using the default set up. If you had
configured custom options on the Compose compiler, see the following section.
plugins {
id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" // this version
}
composeCompiler {
enableStrongSkippingMode = true
reportsDestination = layout.buildDirectory.dir("compose_compiler")
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("st
}
Content and code samples on this page are subject to the licenses described in the Content License
(/license). Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.