When running my Project, I get this error:
Error:Invalid Gradle JDK configuration found. <a href='#open_external_system_settings'>Open Gradle Settings</a>
Platform SDK does not point to valid JDK (C:/Program Files/Java/jdk1.7.0_71)
To fix this I tried setting my javahome in gradle.build as
:findJavaFromJavaHome set JAVA_HOME=C:\Data\jdk1.7.0_55 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
Still I get the same error. Can someone help pls.
The minimum version of Gradle that supports Java 11 is 5.0 . You would need to upgrade to version 7.0 or above for Android.
By default, Gradle uses the java version from the JAVA_HOME environment variable path configured in the machine, and JAVA_HOME points to JDK installed on the machine.
Right click on the deploy or any other task and select "Open Gradle Run Configuration..." Then navigate to "Java Home" and paste your desired java path.
I had this same problem recently.
First make sure your Android Studio is updated.
Then, in the error center, it directs you to a pop-up window which you have to choose between "Local Gradle" and "Recommended Gradle wrapper" (Sorry if names doesn't exactly match since it was while ago)
For me it was set on Local Gradle and I changed it to the "recommended" one and waited so it rebuild the project. After it was done, the errors went away for second and I saw the same error and when I opened that window again, I saw it is set on "Local Gradle" again, although I chose the recommended one.
So I did chose recommended again and this time it was fixed and stayed fixed and I had no problem anymore!
Hope it works for you
UPDATE If the above way doesn't work, it should be because u have recently updated your Java. so see this question and change the path of your Java SDK
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With