flutter_nfc_kit icon indicating copy to clipboard operation
flutter_nfc_kit copied to clipboard

Build fails with issue between java and kotlin

Open martijn00 opened this issue 2 years ago • 7 comments

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).

martijn00 avatar Nov 01 '23 13:11 martijn00

Maybe try higher JDK version like 17?

Harry-Chen avatar Nov 01 '23 14:11 Harry-Chen

No that doesn't work and gives the same error. @mvanbeusekom you looked at this before. Can you give any hints?

martijn00 avatar Nov 01 '23 14:11 martijn00

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?

Harry-Chen avatar Nov 01 '23 14:11 Harry-Chen

Would it be possible to set it to VERSION_17?

martijn00 avatar Nov 01 '23 15:11 martijn00

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.

Harry-Chen avatar Nov 01 '23 15:11 Harry-Chen

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

martijn00 avatar Nov 01 '23 15:11 martijn00

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

martijn00 avatar Nov 01 '23 15:11 martijn00

@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

AristideVB avatar Mar 13 '24 19:03 AristideVB

Fixed in version 3.5.0.

Harry-Chen avatar Apr 04 '24 12:04 Harry-Chen

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

luckycreationsindia avatar Jul 19 '24 09:07 luckycreationsindia