I'm running a flutter project and recently updated a bunch of dependencies. I'm getting this error:
* What went wrong:
Execution failed for task ':flutter_google_places_sdk_android:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).
Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
I've already updated by build.gradle file to include the following, having already seen these questions
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
However, I still get the above error. Here's my flutter doctor:
[✓] Flutter (Channel stable, 3.13.6, on macOS 13.2.1 22D68 darwin-x64, locale en-AU)
• Flutter version 3.13.6 on channel stable at /Users/sophiahuynh/Documents/_gitLabProjects/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ead455963c (8 weeks ago), 2023-09-26 18:28:17 -0700
• Engine revision a794cf2681
• Dart version 3.1.3
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/sophiahuynh/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Users/sophiahuynh/Library/Java/JavaVirtualMachines/jbrsdk-17.0.9/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment JBR-17.0.9+7-1087.3-nomod (build 17.0.9+7-b1087.3)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.13.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.84.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.76.0
[✓] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.2.1 22D68 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.159
[✓] Network resources
• All expected network resources are available.
- I'm running Java 17.0.9 (incl. my java home, android studio gradle jdk)
- I'm running Gradle 8.4 (was running 8.0 before and still facing the same issue)
- Kotlin 1.9.20 (also faced the same issue when I was on 1.8.0)
I'm quite lost at what else I can try to do. Any help is appreciated. Thanks!!