Question

[Solved] Invalid Gradle JDK configuration found?

I am very new in Android Studio. I have a problem with gradle.
it says,

Error:Invalid Gradle JDK configuration found.
Platform SDK does not point to valid `JDK` `(C:/Program Files/Java/jdk1.8.0_20)`.
Consult IDE log for more details (Help | Show Log)

then what should I do to solve that?

Solution #1:

Under Android Studio, select File > Project Structure > JDK location.
Specify the JDK to the folder of your currently installed JDK. And specify the SDK location as well.

Respondent: ctc chen

Solution #2:

If you want / need to, update your JDK installation to the version that you want to use.

Next, find the version for your current JDK installation by running javac -version or java -version. Check that it is what you expect.

Next, find the JDK installation directory:

  • It should be on your %PATH%.
  • By default it will be a subdirectory of “C:Program FilesJava”‘ for example: “C:Program FilesJavajdk1.8.0_45”

Next, start Android Studio, and go to the “File->Project Structure->JDK Location” preference page.

The file path given by the preference should be the path to the JDK installation director that you identified above. If it isn’t then update it.

Notes:

  • Use the full pathname of the installation directory; e.g. “C:Program FilesJavajdk1.8.0_45”.
  • Use a pathname, not a URL.
Respondent: Mahmudur Rahman

Solution #3:

SIMPLE SOLUTION:

  1. Go to build.gradle and at the top there will be a message JDK missing
  2. Click on it and use JDK from the list (or download one if you don’t have)
  3. Sync project

THANKS 🙂

Respondent: Stack Fox

Solution #4:

I got this issue in Android studio 4.2 canary, and I had to delete those generated files:

.idea/gradle.xml
.idea/workspace.xml

then clicking try again to sync the project.

Respondent: spider

Solution #5:

For Android studio Canary Build Arctic Fox 2020.3.1 this seems like a bug or hard dependency with Jdk 11.

I already had jdk defined, but I was still getting this error. Got resolved after installing jdk 11 and providing path to it in the jdk location here

File > Project Structure > JDK location
Respondent: Anuj Garg

Solution #6:

I have solve this problem my App name “Addvoicetomusic2”;
go to app dir-
C:UsersamramAndroidStudioProjectsAddvoicetomusic2

  • then remove .gradle and .idea file
    *then connect to internet
  • restart android studio project
    successfully solve
Respondent: amra ram

Solution #7:

The simple and easy way is

Go To Your build.gradle(Module:app)
At the top right corner you will find notification JDK is missing or download missing JDK
Clik on that notification and download JDK and Sync Project.

Respondent: Raza

Solution #8:

amra ram’s solution worked for me, more or less. I had an old .idea directory with a weird configuration. Deleting it, closing Android Studio, and opening the project again forced it to reinstall and sync Gradle.

Respondent: Dan Rice

Solution #9:

When I encountered this same problem, I solved it by specifying the path to the portable (non installed) JDK8.

Respondent: Julian Kolodzey

Solution #10:

Same error i got when I install android studio on my pc . at the time of installation I have installed android sdk and android studio in different path so In project structure I have set my new sdk path .
Still I got message of invalid jdk …then I knew location of jdk ,again in project structure I have set my jdk path.It works.

Respondent: blackstorm

Solution #11:

For me the problem appeared after updating IntelliJ to version 2020.2.1.

Just solved it by going to Project Structure -> SDK. There I only had the Java jdk. I’ve added IntelliJ IDEA Platform Plugin SDK and that seems to have solved the problem. gradle loads just fine.

Respondent: GivinStatic

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy