问题报错:
Error:Execution failed for task ':lib:compileReleaseJava'.
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
1.遇到这些问题就是:
distributionUrl路径版本过低和classpath的版本过低,如:
在项目中的build.gradle中的依赖classpath为:
dependencies { classpath 'com.android.tools.build:gradle:1.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
在项目中的gradle-wrapper.properties中使用的distributionUrl为:
#Wed Jul 26 17:24:08 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
版本过低这出现上述情况。
2.解决问题:
在项目中的build.gradle中的依赖classpath版本改为2.3.1或者你其他项目中可用的版本:
dependencies { classpath 'com.android.tools.build:gradle:2.3.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
在项目中的gradle-wrapper.properties中使用的distributionUrl改为3.3或者你其他项目中可用的版本:
#Wed Jul 26 17:26:15 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip