0

when i run flutter app it give me this error: │ [!] You need Java 11 or higher to build your app with this version of Gradle. │ but i am using: java 19 ext.kotlin_version = '1.7.10' classpath 'com.android.tools.build:gradle:7.2.0'

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 Answers1

0

You can check the version of Java installed on your system by running the following command in your terminal:

java -version

and also check if your Systems enviroment variable is pointing to the correct java SDK (if you have multiple java installed in different locations).

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 18 '23 at 13:57