Search code examples
javaandroidandroid-studiogradlegradle-task

Android Studio - Execution failed for task compileReleaseJavaWithJavac


I opened an old project separated into 6 modules with Android Studio but it always fails in the building task. My ENV is :

Ubuntu 14.04
OpenJDK7
Android Studio 2.2 preview 2

It was failing in the build for most of the modules and telling me that it can't find a Java Complier, Here you are the error trace :

What went wrong:
Execution failed for task ':maskable_layout:compileReleaseJavaWithJavac'.
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.

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

I was sure that I have JDK installed on my machine and I tried to install Oracle Java and modified JAVA_HOME in my profile file .bachrc but the error didn't disappear.


Solution

  • The answer is to get back to the old version of Android Studio 2.1. It seems to be a problem with the new Android Studio and it's working fine with me on the old version now.