1

I am using kotlin 1.7.20 as below

classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")

When I acess below firebase code from a normal build.gradle, it gets compiled. But when used from inside of buildSrc, I get error as kotlin 1.5.1 module was expected, but found 1.7.1

plugins {
    `kotlin-dsl`
}

repositories {
    google()
    mavenCentral()
}

dependencies {
    // firebase
    implementation (platform("com.google.firebase:firebase-bom:31.0.2"))
    implementation ("com.google.firebase:firebase-firestore-ktx")
}

Error is like below

/Users/xx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/0d0a9e3f3673ba/kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.

My main requirement is to trigger firebase in case of gradle sync through custom task.

I tried changing the values, but didn't work

virat
  • 43
  • 3

1 Answers1

0

This happened due to the version mismatch issue. I recommend you to update the kotlin version to the latest. For this case I am providing the required version by your system which needs changes to this line from build.gradle
From

ext.kotlin_version = '1.5.1'

to

ext.kotlin_version = '1.7.1'
Rohit Kharche
  • 2,541
  • 1
  • 2
  • 13
  • As mentioned above, I am already using kotlin 1.7.20. I have done a full project search - nowhere its mentioned as 1.5.1 – virat Nov 29 '22 at 09:35
  • @virat so which version is declared in `ext.kotlin_version ` ? and is there a classpath like this `classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"` ? – Rohit Kharche Nov 29 '22 at 10:18
  • Yes, Please check my first code line - it's a class path with 1..7.20 version of kotlin – virat Nov 29 '22 at 12:10
  • @virat can you edit the question and provide the entire `build.gradle` file ? – Rohit Kharche Dec 02 '22 at 07:08