This message was deleted.
# community-support
s
This message was deleted.
v
Can you show a build
--scan
?
l
I'm not sure I did this right. Like this? https://scans.gradle.com/s/l2teadb75l4ja
I have
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:_")
in
buildSrc/build.grade.kts
which I understand influences the
kotlin-dsl
version. But changing its version still causes errors
c
There’s no need to adjust the Gradle-embedded Kotlin version - use
kotlin-dsl
as is. The issue is due to a back-version of the kotlin-dsl plugin expecting Kotlin 1.5 but upgraded to Kotlin 1.8.10 (as expected, to align with embedded Kotlin).
btw, this:
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:_")
is not
kotlin-dsl,
which is a Gradle-provided plugin (not Jetbrains). that kotlin-gradle-plugin is from kotlin(“jvm”) in a build script. Related to that, build scripts should never mix kotlin(“jvm”) (which is for your application code) with
kotlin-dsl
(which is for your build script code).
Looking at this plugin view it’s likely there’s a build script that has both
kotlin-dsl
and
kotlin("jvm")
, resulting in conflicting Kotlin versions. As noted above, never do that - any given script (or custom plugin) is either building Gradle code (
kotlin-dsl
) or your application code (
kotlin("jvm")
)
l
I don't think I define both
kotlin-dsl
and
kotlin("jvm")
in the same gradle file... My
buildSrc/build.gradle.kts
looks like this:
Copy code
plugins {
    `kotlin-dsl`
}

repositories {
    google()
    mavenCentral()
    mavenLocal()
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:_")
    implementation("com.android.tools.build:gradle:_")
    implementation("custom plugin already working")
    implementation("new plugin which breaks the build")
}
I've been using refreshVersions for version management. I tried removing
<http://plugin.org|plugin.org>.gradle.kotlin.kotlin-dsl=2.1.7
, but it also does not help
c
this shouldn’t be present for buildSrc projects:
implementation(“org.jetbrains.kotlin:kotlin-gradle-plugin:_“)
v
Why not?
It is the KGP version that is applied by the convention plugin
c
well, it can be, if you intend for your plugin to apply kotlin(jvm), but it may need to be on the compileOnly configuration.
v
Isn't the problem obvious and clear?
This version of Gradle expects version '4.0.7' of the
kotlin-dsl
plugin but version '2.1.7' has been applied to project ':buildSrc'. Let Gradle control the version of
kotlin-dsl
by removing any explicit
kotlin-dsl
version constraints from your build logic.
👆 1
l
But I tried removing
implementation(“org.jetbrains.kotlin:kotlin-gradle-plugin:_“)
and it's still not working
c
that’s not what the message says. somewhere in the plugin code it’s applying the plugin.
v
That's not what I said
l
I also tried to force kotlin-dsl version to 4.0.7 and it wasn't working
v
Just don't use a version but the accessor
And provide a build scan with the correct version applied
We cannot guess what the error changes to ;-)
l
Well, I'm off for the weekend, thank you for trying to help me