title: Android Studio - Could not determine Java version using executable
body: <p>I'm using macOS 11.3 and I currently have an Android project with the Android Gradle plugin version 3.2.1 and Gradle version 3.4 that I'm trying to compile with Android Studio 4.2.1. As this version of Android Studio comes with JDK 11 as a runtime, I've tried to change the runtime of the IDE as detailed <a href="https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under" rel="nofollow noreferrer">here</a> and <a href="https://www.jetbrains.com/help/idea/switching-boot-jdk.html" rel="nofollow noreferrer">here</a></p>
  <p>but I'm getting the following error:</p>
  <p><code>Could not determine Java version using executable /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java.</code></p>
  <p>The project uses Gradle 3.4 which is incompatible with Java 10 or newer.
  See details at <a href="https://github.com/gradle/gradle/issues/4503" rel="nofollow noreferrer">https://github.com/gradle/gradle/issues/4503</a>
  Possible solution:</p>
  <ul>
  <li>Upgrade Gradle wrapper to 4.8.1 version and re-import the project</li>
  </ul>
  <p>Upgrading the Gradle version is not an option in my case due to it's a legacy project that is no longer maintained and in the end, I would have some other compilation problems.</p>
  <p>What I've tried to do is change the JDK of Android Studio to use JDK 8 as detailed  but I'm getting the error &quot;Could not determine Java version using executable /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java.&quot;</p>
  <p>Does anybody has had the same problem? Can it be related to the path set on the <code>Java_HOME</code> variable?</p>