0

I have two JDKs installed on my Windows 10 computer:

  • OpenJDK version 8
  • JDK 11 which comes built-in with Android Studio (under C:\Program Files\Android\Android Studio\jre). (Minor unrelated question: Why is the JDK under a folder named jre? Doesn't make any sense...)

Every time I create a new empty project from scratch and try to run it, Android Studio complains:

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

I think this happens because my PATH environment variable points to OpenJDK 8. Ideally I shouldn't touch this (because I use it for other projects).

I normally solve this problem by going to File -> Settings -> Build, Execution, Deployment -> Build tools -> Gradle and set the JDK to Android's Built-in JDK.

But this is too tiresome: I need to do this for EVERY project I create. I haven't found a way to tell Android Studio: "Hey, use your own JDK by default for every new project, and stop complaining."

I want to know if such way exists.

Hector Ricardo
  • 497
  • 5
  • 16
  • Does this answer your question? [How to set Java SDK path in AndroidStudio?](https://stackoverflow.com/questions/19608742/how-to-set-java-sdk-path-in-androidstudio) – A Farmanbar Sep 18 '21 at 20:07
  • Not really. It just sets the JDK for the current project, but not for the new ones. – Hector Ricardo Sep 18 '21 at 20:15

0 Answers0