Flutter error Kotlin could not find the required JDK tools Flutter error Kotlin could not find the required JDK tools flutter flutter

Flutter error Kotlin could not find the required JDK tools


Step1:

I added the following line to the gradle.properties file

org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_261 your jdk version

Step2:

add the following line to gradle-wrapper.properties file

to the address => \flutter_app\android\gradle\wrapper\gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip


I got this error when my JRE updated, but my JDK didn't. After I downloaded and installed the updated JDK, the error went away.

Here is a link to the JDK download: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html


One of these two methods should help you:

  1. In gradle.properties in the .gradle directory in your HOME_DIRECTORY set org.gradle.java.home=/path_to_jdk_directory

OR:

  1. In your build.gradle
compileJava.options.fork = truecompileJava.options.forkOptions.executable = '/path_to_javac'

answer taken from here