Failed to complete Gradle execution (new project) - java home different

前端 未结 6 2222
感动是毒
感动是毒 2020-12-06 13:07

I downloaded Android Studio version [build 135.1653844] and created a new project. I am getting an error:

Failed to complete Gradle execution.
Cause:
The new         


        
相关标签:
6条回答
  • 2020-12-06 13:41

    I managed to solve this problem by renaming Info.plist and version.plist to Info.plist.old and version.plist.old in /Applications/IntelliJ IDEA.app/Contents/jre/jdk/Contents folder on Mac.

    Executed

    mv Info.plist Info.plist.old | mv version.plist version.plist.old

    in folder mentioned above. Then I just run Intellij and things were working fine. Probably, it would be possible to fix this by renaming only one of these files but I haven't tested it. After fixing it I haven't rename files back to Info.plist and version.plist. Should I?

    After this fix, I also created idea.properties file in ~/Library/Preferences/IntelliJIdea2016.2 and added line gradle.java.home=$(/usr/libexec/java_home)

    0 讨论(0)
  • 2020-12-06 13:47

    Another answer for people looking for a solution:

    In my case, I did not have any 32 bit JVMs installed, so I ran IntelliJ in 64 bit mode instead, and everything worked fine after I set my IDEA_JVM_64 environment variable.

    0 讨论(0)
  • 2020-12-06 13:49

    Bit Late,But will be helpful for someone,

    For me the problem was solved by uninstalling all jdks and installing only one and setting JAVA_HOME for that jdk in my case

    JAVA_HOME
    C:\Program Files\Java\jdk1.7.0_40
    

    Thats All

    0 讨论(0)
  • 2020-12-06 13:57

    Though I did not find the root cause where the different javaHomes have been taken from, at least I found a workaround that worked for me:

    Try setting the following in your gradle.properties (either in %USERPROFILE%\.gradle\ or in your project build dir):

    org.gradle.java.home=C:\Program Files\Java\jdk1.6.0_45\jre
    
    0 讨论(0)
  • 2020-12-06 13:58

    I deleted the jre from the installation file of inttellij, but when I tried to run intellij, i said that I tried to run a 32bit version of intellij, but no jre for 32bit was found, then I when to the intellij installation directory and run a 64bit version, and the problem was solved.

    0 讨论(0)
  • 2020-12-06 14:07

    This error appear most likely downloading applications (such as Oracle, Application servers...) that include java version or installing another JDK/JRE.

    I managed to solve the this problem by deleting/renaming all JDK/JRE and forders and only keep one and only one JDK folder and contains JRE folder inside.

    also I put the JDK path into JAVA_HOME and path vatiables and remove any other JDK/JRE paths from the environment variables.

    After that reset the JDK home in your IDE.

    Regards, Mohammed Kharma

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