After restarting my project with almost no changes I suddenly got this errorlog:
Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.5.31/43331609c7de811fed085e0dfd150874b157c32/kotlin-stdlib-common-1.5.31.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.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.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.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.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.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-android/1.5.2/d246a704a55b7bddb79407cce4348890eaa341d9/kotlinx-coroutines-android-1.5.2.jar!/META-INF/kotlinx-coroutines-android.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.5.2/f4cc07a50437659e0043e7da762809a46932b6a0/kotlinx-coroutines-core-jvm-1.5.2.jar!/META-INF/kotlinx-coroutines-core.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/transforms-2/files-2.1/510d2c0b665cbe8abe1bcbf4bf8b6987/window-java-1.0.0-beta04/jars/classes.jar!/META-INF/window-java_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/Gerald/.gradle/caches/transforms-2/files-2.1/7ad239db5bbf66449a1f587f3afa295b/jetified-window-1.0.0-beta04/jars/classes.jar!/META-INF/window_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (20, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (21, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (25, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (26, 14): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (28, 14): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
C:/Users/Gerald/.gradle/caches/transforms-2/files-2.1/7ad239db5bbf66449a1f587f3afa295b/jetified-window-1.0.0-beta04/jars/classes.jar!/META-INF/window_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (20, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (21, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (25, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (26, 14): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (28, 14): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\maps_launcher-2.0.1\android\src\main\kotlin\com\example\maps_launcher\MapsLauncherPlugin.kt: (33, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from C:/Users/Gerald/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.31/6628d61d0f5603568e72d2d5915d2c034b4f1c55/kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
Flutter says I have to add a line in my android/build.gradle, after doing that, nothing happens I have also tried clearing all the caches, same error.
buildscript {
ext.kotlin_version = '1.6.10' // line to add
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.8'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have also tried to downgrade 'com.android.tools.build:gradle:3.5.1' to 3.2.1 after reading a thread about it. Error of trying that
Where:
Build file 'E:\GitHub\BauFuchs\baufuchs\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
Line 24 of app build.gradle
apply plugin: 'com.android.application'
Thanks for your help I have to start working again I can't do anything
CodePudding user response:
Try upgrading gradle distribution to match kotlin version. Open android/gradle/wrapper/gradle-wrapper.properties and replace distributionUrl to eg. distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip or newer.
Make sure to run flutter clear after applying the changes.
CodePudding user response:
I fixed it
I created a temporary Flutter project, looked at the android/build.gradle, updated the versions of the classpaths and looked into android/gradle/gralde-wrapper.properties and copied the distribution aswell.