Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugin with id 'org.jetbrains.kotlin.plugin.compose' not found

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?

like image 442
Elye Avatar asked Jun 27 '26 07:06

Elye


1 Answers

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

like image 170
EpicPandaForce Avatar answered Jun 29 '26 22:06

EpicPandaForce