Gradle cannot find the kotlin-dsl plugin in buildSrc or an included build
org.gradle.kotlin.kotlin-dsl was not foundShort answer
The kotlin-dsl plugin is resolved like any other plugin, from the repositories in pluginManagement. If settings.gradle(.kts) lists only google() or leaves out gradlePluginPortal(), or the plugin line carries a version that does not match your Gradle, resolution fails. Fix the repositories, and apply the plugin with the kotlin-dsl accessor.
Fix it fast
1Find out which cause you have
Open the file that applies the plugin (usually buildSrc/build.gradle.kts or the build-logic one) and the settings file of that build. Note the plugin line and the pluginManagement repositories.
cat buildSrc/build.gradle.kts cat settings.gradle.kts2Match what you see, then jump to its fix
What does the error look like?
org.gradle.kotlin.kotlin-dsl was not found
Cause 1 of 2
pluginManagement leaves out the Gradle Plugin Portal
1Check
Gradle's plugin docs say plugins resolve from the Gradle Plugin Portal by default, and that a repositories block inside pluginManagement replaces that, so the portal is searched only if you list it.
grep -n -A8 "pluginManagement" settings.gradle settings.gradle.kts2Fix
Add gradlePluginPortal() to pluginManagement.repositories in the settings file of the build that applies the plugin.
// settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}3Verify
Run any task of the build; the plugin resolves.
./gradlew helpConfirmed by docs.gradle.org
Cause 2 of 2
The plugin is declared with a version that does not belong to this Gradle
1Check
Gradle's Kotlin DSL docs say each Gradle release is meant to be used with a specific version of the kotlin-dsl plugin, and that an unexpected version causes warnings and hard-to-diagnose problems.
./gradlew --version
grep -rn "kotlin-dsl" --include=*.kts --include=*.gradle .2Fix
Use the kotlin-dsl accessor with no version, and add a repository for the Kotlin compiler dependencies, as the docs show for buildSrc.
// buildSrc/build.gradle.kts
plugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
}3Verify
Build again. The plugin now matches the running Gradle.
./gradlew helpConfirmed by docs.gradle.org
How do I stop it coming back?
- Keep pluginManagement repositories in one settings file and copy them to each included build that needs them.
- Do not pin a version on kotlin-dsl; let the Gradle version decide.
- After raising Gradle, check the compatibility table for the embedded Kotlin version.
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:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Nuclear Home VideoA video-streaming Android app built from scratch, engineered for smooth playback.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
Gradle says the plugin id you asked for does not exist in any repository it searched
Gradle Central Plugin Repository (no 'google()' listed)
Gradle searched every repository listed for plugins and none had that id at that version.
3 causes, each with a fixMobile apps
Android build fails because a product flavor has no flavor dimension
The flavor 'flavor_name' is not assigned to a flavor dimension.
Android Gradle plugin refuses to build when a product flavor is not assigned to a flavor dimension.
2 causes, each with a fixMobile apps
AGP 9 marks the android block as deprecated or fails on BaseExtension
java.lang.ClassCastException: class com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated_Decorated cannot be cast to class com.android.build.gradle.BaseExtension
AGP 9.0 uses only the new public DSL interfaces.
3 causes, each with a fixMobile apps
Android build fails because two libraries ship the same META-INF file
More than one file was found with OS independent path
Two dependencies put a file at the same path inside the APK and the plugin will not guess which one wins.
3 causes, each with a fixMobile apps
The editor cannot find R, so every R.string and R.id turns red
Unresolved reference: R
R is a class that the build generates from your res folder, in the package named by the module's namespace.
4 causes, each with a fixMobile apps
Android Studio says it could not identify the launch activity when you press Run
Run > Edit Configurations > Launch Options is set to Nothing or to a class that no longer exists
Android Studio launches the activity marked with a MAIN action and a LAUNCHER category in the merged manifest.
3 causes, each with a fix