IDEA使用gradlew build命令打包Could not find tools.jar

1,669 阅读1分钟

错误提示

What went wrong: Execution failed for task ':compileJava'.
Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_101 contains a valid JDK installation.

解决办法

I've solved this issue by putting gradle.properties file in the same dir as build.gradle with exact path to my JDK:

org.gradle.java.home = C:/Dev/JDK

参考

stackoverflow.com/a/29417705/…
wajahatkarim.com/2018/06/gra…