Skip to content

Kotlin stdlib does not match Gradle's embedded Kotlin version #51

Open
@aSemy

Description

@aSemy

When I look in the .module metadata for the Gradle plugins I can see that they have a dependency on kotlin-stdlib 1.9.22

      "dependencies": [
        {
          "group": "org.jetbrains.kotlin",
          "module": "kotlin-stdlib",
          "version": {
            "requires": "1.9.22"
          }
        }
      ],

https://plugins.gradle.org/m2/androidx/build/gradle/gcpbuildcache/gcpbuildcache/1.0.0-beta07/

The dependency is automatically added by the Kotlin JVM plugin.

This does not match the version of Kotlin that is embedded with Gradle. In fact, in order to be compatible with a wide range of Gradle version no dependency should be specified at all. The Kotlin stdlib dependency will be provided at runtime by Gradle.

Suggestions

  • Replace the Kotlin/JVM plugin with the embedded-kotlin plugin (I recommend this, it's easier!)

      // build.gradle.kts
      plugins {
          id("maven-publish")
          id("signing")
          id("bundle")
          alias(libs.plugins.gradle.publish)
    -     alias(libs.plugins.kotlin.jvm)
    +     `embedded-kotlin`
      }
  • Manually exclude the kotlin-stdlib dependency (for an example, see Dokka Gradle Plugin).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions