1. 程式人生 > >AndoridStudio執行報錯,Cannot find System Java Compiler. Ensure that you have installed a JDK......

AndoridStudio執行報錯,Cannot find System Java Compiler. Ensure that you have installed a JDK......

詳細報錯資訊如下

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> 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.

原因

  你要匯入專案的gradle版本不對,要麼過高要麼過低,建議將gradle版本改為新建專案的gradle版本

解決方案

  在找到project下面的build.gradle,修改gradle版本。如果不知道具體是哪個版本,可以直接複製新建專案的build.gradle版本。比如:將classpath ‘com.android.tools.build:gradle:1.3.0’修改為classpath ‘com.android.tools.build:gradle:2.2.3’

———-因本人才疏學淺,如部落格或Demo中有錯誤的地方請大家隨意指出,與大家一起討論,共同進步,謝謝!———-