5

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:

enter image description here

Versions:

OS: Windows 10 64-bit
Android Studio Version: 3.1.0.16
JDK Version: 10

gldanoob
  • 762
  • 1
  • 7
  • 18
  • Did you happen to see [this post](https://stackoverflow.com/questions/47150410/failed-to-run-sdkmanager-list-android-sdk-with-java-9) or [that](https://stackoverflow.com/questions/48870244/error-running-app-no-jdk-specified)? – Naman Apr 04 '18 at 03:28
  • @nullpointer I've made sure that the paths are correct – gldanoob Apr 04 '18 at 04:22
  • 1
    Is my JDK too new that even Android Studio doesn't support it? – gldanoob Apr 04 '18 at 04:25
  • @Caleb It probably is. Did you try [going back to JDK 9.0.4](http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html) for the time being? – NoDataDumpNoContribution Apr 05 '18 at 23:26
  • Alternatively use a higher gradle version like 4.6 (the current one). Not sure where in Android Studio or in the project you set this. I only use IntelliJ and gradle wrappers. – NoDataDumpNoContribution Apr 05 '18 at 23:42

1 Answers1

2

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'

}
reza rahmad
  • 1,009
  • 10
  • 16