Hi, I am working on android studio project and this error keeps showing. I have synced project with gradle file but doesn’t work.
e: /Users/aimeel/.gradle/caches/transforms-3/a18e86742e01f373d28c7f0b41fd2e27/transformed/jetified-kotlin-stdlib-1.9.22.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: /Users/aimeel/.gradle/caches/transforms-3/a18e86742e01f373d28c7f0b41fd2e27/transformed/jetified-kotlin-stdlib-1.9.22.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: /Users/aimeel/.gradle/caches/transforms-3/a18e86742e01f373d28c7f0b41fd2e27/transformed/jetified-kotlin-stdlib-1.9.22.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: /Users/aimeel/.gradle/caches/transforms-3/a9b0232f4527e5bfb06ec29228a49c3a/transformed/jetified-play-services-measurement-api-21.6.2-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:compileDebugKotlin’.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details
The build scan is not too useful as it is not if the failing build.
But anyway this is not really a Gradle topic. You try to use a Kotlin 1.9 compiled library while compiling with Kotlin 1.7, this does not work.
I can only guess that you did not do it correctly.
You either cannot use what was compiled with Kotlin 1.9 when compiling with 1.7, or need to compile with newer than 1.7.
Hi- i’m also experiencing this error: Class 'kotlin.collections.ArraysKt___ArraysKt' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
Among a mass of similar errors regarding Kotlin versions.
This happened after coming back to a project to make a small tweak, and found myself needing to upgrade Gradle for Play Store compliance. I don’t use Kotlin in my project, as it’s a React Native app. Anyone have some suggestions? I’ve tried setting the kotlinVersion = “1.6.0” in the android/app/build.gradle with no luck
The error says you are using Kotlin 1.6.x but try to use a library that was compiled with Kotlin 1.8.x and thus is not compatible as Kotlin 1.6.x can read at most libraries compiled with Kotlin 1.7.x.
Do you have any suggestions that would help determine what library or libraries may be incompatible? Assuming it’s whatever React Native is trying to use, but not what i’ve personally added.
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}
Do you have any suggestions that would help determine what library or libraries may be incompatible?
Actually the error says the problematic class is kotlin.collections.ArraysKt___ArraysKt, so it is kotlin-stdlib library.
Check in a build --scan or with dependencies or dependencyInsight tasks which version you’ve got and where it comes from.
e: /Users/yurigochi/Documents/code/Bizuu/app-bizuu/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt: (22, 47): Class 'kotlin.collections.CollectionsKt___CollectionsKt' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
The class is loaded from /Users/yurigochi/.gradle/wrapper/dists/gradle-8.0-all/a2o1xoguejy6msdh0lk99lxza/gradle-8.0/lib/kotlin-stdlib-1.8.10.jar!/kotlin/collections/CollectionsKt___CollectionsKt.class
e: /Users/yurigochi/Documents/code/Bizuu/app-bizuu/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt: (24, 12): Class 'kotlin.collections.ArraysKt___ArraysKt' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
The class is loaded from /Users/yurigochi/.gradle/wrapper/dists/gradle-8.0-all/a2o1xoguejy6msdh0lk99lxza/gradle-8.0/lib/kotlin-stdlib-1.8.10.jar!/kotlin/collections/ArraysKt___ArraysKt.class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
> Compilation error. See log for more details
buildscript {
ext.kotlin_version = '1.8.10' // Update this line with the new version
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 27
compileSdkVersion = 34
targetSdkVersion = 34
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
dependencies {
classpath("com.android.tools.build:gradle:8.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath 'com.google.gms:google-services:4.3.15'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}