bhoominn / nb_utils

Collection of Widgets and helpful Methods that every developer needs.
https://pub.dev/packages/nb_utils
MIT License
139 stars 46 forks source link

Execution failed for task ':nb_utils:compileDebugKotlin'. 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) #55

Open dhruvikapdiwebiots opened 4 months ago

dhruvikapdiwebiots commented 4 months ago

Execution failed for task ':nb_utils:compileDebugKotlin'.

'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version. Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

SriFromFindStoneAge commented 4 months ago

i also have same issue try to remove pub caches in your local path

princeflutterdev commented 4 months ago

i also facing the same issue

SriFromFindStoneAge commented 4 months ago

i think it is not working for kotlin 1.9.0

SriFromFindStoneAge commented 4 months ago

01.The issue is this package is not working for kotlin 1.9.0 02.Specialy when we use with flutter stripe package we can not use current version of this package. 03.after i got a error in a development i tested this package seperately.

2024-05-31 03_35_32-Window

RoyalCoder88 commented 2 months ago

have the same issue, any fixes, or updates? thx

bhoominn commented 1 month ago

Yes.

EthanBarlow commented 1 month ago

@SriFromFindStoneAge Does version 7.0.4 work for you even with the Stripe package? I've been having the the same problem. I tried the example project and a new flutter project with the nb_utils package and both worked. However, as soon as I try to use nb_utils (even version 7.0.4) with my actual app, I get the jvm target compatibility error again.

SzymonDziak commented 1 month ago

same

azaj01 commented 1 month ago

I simply got rid of this package because of this issue

spyhunter88 commented 1 month ago

Same error here, does anyone have any suggestion?

* What went wrong:
Execution failed for task ':nb_utils:compileReleaseKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (1.8) and 'compileReleaseKotlin' (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 try to change android compileOption to 17 but not work.

android {
    namespace "my.app"
    compileSdk 34 // flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility 17
        targetCompatibility 17
    }

    kotlinOptions {
        jvmTarget = '17'
    }
....
}

Also try to run flutter build --jdk-dir "/path/to/jdk18" still error Inconsistent between 1.8 and 18.

bhoominn commented 1 month ago

Could you please confirm whether you are using the stripe package alongside the nb_utils package?

spyhunter88 commented 1 month ago

If you ask me, I dont use Stripe library. I rollback to gradle 7.6.3, plugin 1.9.20, delete the hosted/pub.get folder in C drive. Now it can compile with bunk of incompatible warning and error.

Rissmon commented 1 month ago

I added a fix and raised a PR. We will have to wait for the approval and if any one is blocked with this issue then you can directly add my repo to your pubspec.yml Replace :

dependencies:
  nb_utils: ^7.0.4

With

dependencies:
  nb_utils:
    git: https://github.com/Rissmon/nb_utils

Once PR is merged we can revert the pubspec change.

arifikhsan commented 4 weeks ago

any update? i still got the same issue

Shahidbangash commented 3 weeks ago

i have applied fix in this Pull Request #60 . Some one please confirm this

Screenshot of example app

Screenshot 2024-09-02 at 3 34 45 AM