flutter_nfc_kit
flutter_nfc_kit copied to clipboard
Build fails with issue between java and kotlin
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':flutter_nfc_kit:compileDebugKotlin'.
Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (11) and 'compileDebugKotlin' (17).
Maybe try higher JDK version like 17?
No that doesn't work and gives the same error. @mvanbeusekom you looked at this before. Can you give any hints?
In flutter_nfc_kit, sourceCompatibility was set to 11:
https://github.com/nfcim/flutter_nfc_kit/blob/cc5c098700e618ba5629dbc33a00fce1cae12863/android/build.gradle#L22-L25
Would it be some other dependency that causes the problem?
Would it be possible to set it to VERSION_17?
tasks 'compileDebugJavaWithJavac' (11) and 'compileDebugKotlin' (17).
Please note that the version 11 does not come from our project since we have no Java code at all. Maybe you should check other dependencies, or at least provide a minimal project that can reproduce this problem.
What about: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/android/build.gradle#L26
And why not set it to VERSION_1_8 like the official Flutter plugins: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/android/build.gradle#L51
Here: https://github.com/nfcim/flutter_nfc_kit/blob/cc5c098700e618ba5629dbc33a00fce1cae12863/android/gradle/wrapper/gradle-wrapper.properties#L4
I use: https://services.gradle.org/distributions/gradle-8.3-all.zip
@Harry-Chen You should indeed set it to 17, see similar issue on other package https://github.com/matanshukry/flutter_google_places_sdk/issues/71
Fixed in version 3.5.0.
Here:
https://github.com/nfcim/flutter_nfc_kit/blob/cc5c098700e618ba5629dbc33a00fce1cae12863/android/gradle/wrapper/gradle-wrapper.properties#L4
I use: https://services.gradle.org/distributions/gradle-8.3-all.zip
Facing this issue with latest flutter version with gradle 8+
Note: I'm using gradle 8.7 due to compatibility issue with latest flutter version