I am getting following error while trying to run my app from android studio
Execution failed for task ':app:compileDebugJava'. 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
.
After searching on internet, I found some solution like this
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45/
so i gave this command in terminal from android studio dirctory but its not workout it show the same error again.
Updating my Gradle build version did the trick for me.
Old:
classpath 'com.android.tools.build:gradle:1.0.0'
New:
classpath 'com.android.tools.build:gradle:2.2.3'
Edit: Since this answer is still being used frequently, note that Gradle 2.2.3 can probably be substituted with any newer version of Gradle. This version just happened to be the version I was using when I originally answered the question.
In your android-studio find it in File->Other Settings->Default Project Structure->SDKs. Then i changed JDK home path.
To fix this error in Andriod Studio 2.3.1 I had to go to File > Project Structure
or Ctrl+Alt+Shift+S then go to SDK Location which was already open for me and then uncheck "Use embedded JDK" and point to where my installed version was.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With