I'm trying to get on to latest Kotlin version 2.1.0 for my old project that has Build.gradle. So I follow https://developer.android.com/develop/ui/compose/compiler by adding Compose Compiler Gradle plugin.
In my project's build.gradle, I have
buildscript {
apply from: 'dependencies.gradle'
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:8.5.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0"
classpath ....
}
}
In my app module's build.gradle, I have
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose' // Newly added
FYI, I have also tried the latest syntax
plugins {
id("com.android.application")
id("kotlin-android")
id("org.jetbrains.kotlin.plugin.compose")
}
When I try to sync, it complains
A problem occurred evaluating project ':App'.
> Plugin with id 'org.jetbrains.kotlin.plugin.compose' not found.
What did I miss?
For the legacy syntax, you have to add it like this:
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:2.1.20")
}
}
apply(plugin = "org.jetbrains.kotlin.plugin.compose")
You get it from here: https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.compose
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With