我首先创建了一个新的 flutter 项目。
但我得到了这个错误:
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\Java\jre1.8.0_261' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 33s
Exception: Gradle task assembleDebug failed with exit code 1
我也尝试过这种方法,但没有奏效。最佳答案
步骤1:
我将以下行添加到 gradle.properties 文件org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_261
你的 jdk 版本
第2步:
将以下行添加到 gradle-wrapper.properties 文件
到地址 => \flutter_app\android\gradle\wrapper\gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
关于java - Flutter 报错 Kotlin 找不到所需的 JDK 工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63177661/