Android - Execution Failed For Task ':app:compiledebugjavawithjavac'
Solution 1:
Setting the JAVA_HOME variable to C:\Program Files\Java\jdkX.XX worked for me.
It was previously set to the JRE directory for some reason.
Solution 2:
Are you on Linux? What does echo $JAVA_HOME
outputs?
I had a similar issue when running react-native run-android
. After setting $JAVA_HOME (which hadn't existed) to a JDK folder, the problem was solved. In my case, I added the following line to the end of .bashrc file:
export JAVA_HOME="path/to/a/folder/with/JDK/jdk1.8.0_60"
and restarted the terminal.
Solution 3:
I deleted .gradle
file from project root directory and rebuilt the app and then everything was working fine.
Solution 4:
For anyone facing this issue after updating to AndroidStudio-2.0
I previously had AndroidStudio-1.3 and jdk-1.7.X_XX. When I updated to AndroidStudio-2.0, things worked fine until I rebooted the computer. After reboot, I encountered this error and none of the above answers worked for me. Here's what I did:
- Copied the project into a new folder
- Upgraded my jdk version from 1.7.X_XX to 1.8.X_XX
Changed the JDK's path in the project structure to the new path:
C:\Program Files\Java\jdk1.8.X_XX
Gradle sync
And things worked.
Solution 5:
ALL above answers are correct. I just wanna mention that if you are using MAC, and the full path of JDK path should be
"/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home"
Do not miss /Contents/Home
Post a Comment for "Android - Execution Failed For Task ':app:compiledebugjavawithjavac'"