Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4133 pages
Flutter and app store releases

Gradle cannot find the Compose compiler plugin when you set up or upgrade a Compose project

Your error

Plugin [id: 'org.jetbrains.kotlin.plugin.compose', version: '1.9.24', apply: false] was not found in any of the following sources:1 more line it can show

Fix it fast

Most common cause, 1 of 3

The project is still on Kotlin 1.9

Raise Kotlin to a 2.x release, then add the plugin with that same version through the catalog.

Fix
# gradle/libs.versions.toml
[versions]
kotlin = "2.4.10"

[plugins]
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

The Compose Compiler Gradle plugin, id org.jetbrains.kotlin.plugin.compose, only exists for Kotlin 2.0 and newer, and its version must equal your Kotlin version. Asking for it with 1.9.24 fails because no such release was published. Move the project to Kotlin 2.x, give the plugin the same version as the Kotlin plugin, apply it in each Compose module and drop composeOptions.

  • Applies to Kotlin 2.x, Android Gradle Plugin 8.x and 9.x, Gradle 8 and 9
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Find the Kotlin version the build uses and the version requested for the Compose plugin. They must be the same number, and it must start with 2.

Run this first
grep -rnE "kotlin *=|org.jetbrains.kotlin.(android|plugin.compose)" gradle/libs.versions.toml build.gradle* settings.gradle* app/build.gradle* 2>/dev/null

Then find the line you see in this list and open its fix:

  1. 1The project is still on Kotlin 1.9The version in the error starts with 1., for example 1.9.24
  2. 2The plugin is declared but not applied, or applied without a versionPlugin with id 'org.jetbrains.kotlin.plugin.compose' not found, raised from a module build file
  3. 3Old composeOptions settings are left after the upgradeThe module still has a composeOptions block with kotlinCompilerExtensionVersion after the move to Kotlin 2

What does the error look like?

  • Plugin [id: 'org.jetbrains.kotlin.plugin.compose', version: '1.9.24', apply: false] was not found in any of the following sources:
  • Plugin with id 'org.jetbrains.kotlin.plugin.compose' not found.

Cause 1 of 3

The project is still on Kotlin 1.9

You seeThe version in the error starts with 1., for example 1.9.24

Check

Android's Compose compiler page says the Gradle plugin is available from Kotlin 2.0 onward. Before 2.0 the compiler was a separate androidx artifact chosen with kotlinCompilerExtensionVersion, so there is nothing for Gradle to download at 1.9.x.

Check
grep -rn kotlinCompilerExtensionVersion app/build.gradle*

Fix

Raise Kotlin to a 2.x release, then add the plugin with that same version through the catalog. Kotlin's migration guide covers the step from 1.9.

Fix
# gradle/libs.versions.toml
[versions]
kotlin = "2.4.10"

[plugins]
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

Verify

Sync Gradle; the plugin resolves and the build reaches compilation.

Verify
./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

The plugin is declared but not applied, or applied without a version

You seePlugin with id 'org.jetbrains.kotlin.plugin.compose' not found, raised from a module build file

Check

The root file should declare the plugin with apply false so the version is known, and each module that uses Compose applies it. A module that applies the id while the root never declared it has no version to resolve.

Check
grep -n "compose" build.gradle.kts
grep -n "compose" app/build.gradle.kts

Fix

Declare once at the root, apply in the module. Without a catalog, put the version on the module line or on a classpath entry in the root buildscript.

Fix
// build.gradle.kts (root)
plugins {
    alias(libs.plugins.compose.compiler) apply false
}

// app/build.gradle.kts
plugins {
    alias(libs.plugins.compose.compiler)
}

Verify

Gradle sync finishes, and the module's tasks list includes the Kotlin compile tasks with Compose enabled.

Verify
./gradlew :app:compileDebugKotlin

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

Old composeOptions settings are left after the upgrade

You seeThe module still has a composeOptions block with kotlinCompilerExtensionVersion after the move to Kotlin 2

Check

Kotlin's guide says the Gradle plugin overrides the compiler coordinates that AGP would otherwise add. The kotlinCompilerExtensionVersion line from the 1.9 setup no longer controls anything.

Check
grep -n -A3 composeOptions app/build.gradle*

Fix

Remove the composeOptions block. Keep buildFeatures compose = true, and move compiler options into a top-level composeCompiler block.

Fix
android {
    buildFeatures {
        compose = true
    }
    // composeOptions { kotlinCompilerExtensionVersion = "1.5.14" }  <- delete
}

composeCompiler {
    reportsDestination = layout.buildDirectory.dir("compose_compiler")
}

Verify

A clean build passes and Compose previews render in Android Studio.

Verify
./gradlew clean :app:assembleDebug

Confirmed by kotlinlang.org

Did this fix it?

How do I stop it coming back?

  • Keep one kotlin version entry in the catalog and point both Kotlin plugins at it with version.ref.
  • Upgrade Kotlin and the Compose plugin in one change; never pin them separately.
  • Remove migration leftovers such as composeOptions in the same pull request as the upgrade.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.