Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio error After run the project

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.

like image 593
Hari Haran Avatar asked Feb 21 '14 04:02

Hari Haran


3 Answers

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.

like image 116
eatcrayons Avatar answered Nov 15 '22 18:11

eatcrayons


In your android-studio find it in File->Other Settings->Default Project Structure->SDKs. Then i changed JDK home path.

like image 51
Hari Haran Avatar answered Nov 15 '22 18:11

Hari Haran


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.

like image 5
Brockenstein Avatar answered Nov 15 '22 18:11

Brockenstein