Reputation: 802
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)
OS: Windows 10 64-bit
Android Studio Version: 3.1.0.16
JDK Version: 10
Upvotes: 5
Views: 5937
Reputation: 1049
it happen in android studio 3.2.0 when your import your project to new android studio you must use this build gradle or newer
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
}
Upvotes: 3