I wanted to use my JDK 10 in my Android Studio. I went to Files > Project Structure and specified my JDK location:
C:\Program Files\Java\jdk-10
After I clicked 'OK', it showed me a Gradle sync failed
message with an error:
Could not determine Java version using executable C:\Program Files\Java\jdk-10\bin\java.exe.
I've set the JAVA_HOME variable to my jdk and jre folder, and the path variable to C:\ProgramData\Oracle\Java\javapath
but the problem still occurs.
I can also find the Java version with the command:
"C:\Program Files\Java\jdk-10\bin\java.exe" -version
which gives me the correct version:
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
Screenshot:
Versions:
OS: Windows 10 64-bit
Android Studio Version: 3.1.0.16
JDK Version: 10