I downloaded a Android project and wanted to try it. So I imported it to Android Studio (2.2) and when running the project i get the error:
Error: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.
Before the runnning of every project worked and i'm searching for days but still found no working solution.
EDIT: Here is my project structure: project structure
Maybe someone of you has the solution.
The value that you want to add is most likely C:\Program Files\Java\jdk-14.0. 2\bin if you are installing "JDK 14.0. 2". This is the location where the Java compiler ('java.exe') was installed in your file system.
It means that javac.exe executable file, which exists in bin directory of JDK installation folder is not added to PATH environment variable. You need to add JAVA_HOME/bin folder in your machine's PATH to solve this error. You cannot compile and run Java program until your add Java into your system's PATH variable.
Open your project in Android Studio and select File > Settings... > Build, Execution, Deployment > Build Tools > Gradle (Android Studio > Preferences... > Build, Execution, Deployment > Build Tools > Gradle on a Mac). Under Gradle JDK, choose the Embedded JDK option.
As per the docs, JDK 17 isn't supported yet in Android Studio.
This kind of problem arises when you compile old project in your new updated Android Studio IDE Version. Technically speaking : gradle build version is old. Just update with new
This can be achieve editing inside build.gradle(Project: App name)
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
//update latese gradle build version.
}
This might do the trick.
I think, you didn't setup JDK for current project. You've just loaded the code. Do it in project structure.
You can do it here: File > Project Structure > [Platform Settings] > SDKs.
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