My flutter code that I have been writing in Android Studio is building fine on iOS. However if I try to run it on an Android simulator, I get a lenghty error message that I don’t understand. The last bit of it says
[!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update /Users/valerievogt/StudioProjects/chuddyapp/android/build.gradle: │
│ ext.kotlin_version = '<latest-version>'
So I went ahead and added the kotlin version to my android/build.gradle like so:
buildscript {
ext.kotlin_version = '1.9.23'
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
This is my settings.gradle:
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.23" apply false
}
include ":app"
The error persists though and nothing has changed.
I tried updating and upgrading all dependencies, flutter, android sdk, studio and already replaced two packages, but I keep getting this error.
The whole error message reads like this and is way above my head:
e: /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.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/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.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/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.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/username/.gradle/caches/transforms-3/8e8d6d4aa01a38286ceaa1a7db4d6398/transformed/jetified-kotlin-stdlib-common-1.9.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.9.0, expected version is 1.7.1.
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (44, 38): Unresolved reference: ArrayList
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (45, 30): Unresolved reference: HashMap
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (63, 14): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (64, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (65, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (66, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (67, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (68, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (73, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (77, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (78, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (79, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (80, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (81, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (87, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (87, 33): Unresolved reference: startsWith
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (88, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (90, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (91, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (92, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (94, 29): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (95, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (99, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (104, 33): Unresolved reference: startsWith
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (105, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (105, 33): Unresolved reference: startsWith
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (106, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (107, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (109, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (111, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (113, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (115, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (117, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (119, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (120, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (125, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (130, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (132, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (133, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (135, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (140, 57): Unresolved reference: startsWith
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (142, 32): Unresolved reference: HashMap
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (147, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (153, 34): Unresolved reference: startsWith
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (154, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/username/.pub-cache/hosted/pub.dev/flutter_tts-4.0.2/android/src/main/kotlin/com/tundralabs/fluttertts/FlutterTtsPlugin.kt: (155, 27): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/username/.gradle/caches/transforms-3/2ece6433a8ec3065ee1b823ef5a57766/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
[.........deleted some bc of character limit]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_tts:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 19s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update /Users/username/StudioProjects/chuddyapp/android/build.gradle: │
│ ext.kotlin_version = '<latest-version>' │
└────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
```
What steps can I take to solve this? I'm overwhelmed.
2
Answers
the fact to define the right version in the settings.gradle worked fine for me to fix this error
The solution for me was to change the
/android/settings.gradle
kotlin plugin to match the version I upgraded to. From your description you would need 1.9.23, so insettings.gradle
change the kotlin version:and rebuild.
Since you already have that in your files I expect the old version is still cached. To clear that using a flutter terminal enter:
flutter clean
then
flutter get
to refresh your flutter packages.
In Android Studio (I’m on Hedgehog 2023.1.1 Patch 2), from the menu choose
Build >> Clean Project
then
File >> Invalidate Caches...
Then
Build >> Rebuild Project
to get it running again.Hope this works for you, or whoever else ends up here.