IntelliJ Gradle Plugin: The supplied javaHome seems to be invalid

前端 未结 14 642
暗喜
暗喜 2020-12-23 08:41

Similar to:
- Intellij 14 the supplied javaHome seems to be invalid
- Android Studio - supplied javaHome is not a valid folder

However, I am trying to use

相关标签:
14条回答
  • 2020-12-23 09:25

    This can be fixed by setting the Project SDK in Module settings to a JDK (as opposed to the Module SDK (which shall be Android SDK)

    0 讨论(0)
  • 2020-12-23 09:25

    I tried this and it worked for me flawlessly. go To SETTING-->SEARCH 'Gradle'---> and choose Gradle JVM and choose the option Use JAVA_HOME C:\ProgramFiles\Java\JDK\1.8 hope this helps someone.

    0 讨论(0)
  • 2020-12-23 09:26

    in IntelliJ 2018.1, I ran into this problem because my project SDK was set to Kotlin instead of a JDK. So, despite having a Kotlin project, it would only build if the SDK is a JDK.

    0 讨论(0)
  • 2020-12-23 09:28

    Upgrading IntelliJ UE from v14.1.1 to 14.1.7 worked for me.

    0 讨论(0)
  • 2020-12-23 09:29

    I've solved this issue by putting gradle.properties file in the same dir as build.gradle with exact path to my JDK:

    org.gradle.java.home = C:/Dev/JDK
    

    Actually it is not a correct solution, probably it should be fixed in IDE, I see in IDEA logs something like (when I executing gradle task of already imported project):

    INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Dev/JDK
    

    But when I going to import gradle module to the project I don't see such kind of message, probably IDEA passes link to bundled JRE which is actually not a JDK.

    0 讨论(0)
  • 2020-12-23 09:29

    I encountered the same problem for quite a while and no matter how many forums I looked at it just did not solve the problem.

    Long story short, I found out my antivirus quarantined the java.exe file. So I advise you to open your antivirus and restore the Java.exe file then relaunch android studios.

    0 讨论(0)
提交回复
热议问题