Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Sync Failure in Fresh IntelliJ IDEA Install

I have a new MBP (16" 2019). Downloaded a fresh copy of IntelliJ IDEA Ultimate 2020.1.1. Used SDKMan to install Java 11-zulu and latest Gradle, 6.4. Went to File->New-Project and chose Gradle. When it loads, I get a Sync error and gradle won't process in IntelliJ correctly. Everything works fine from the CLI. I tried with importing an existing gradle project, different Java and Gradle versions, all give the same vague error.

idea.log

Caused by: org.gradle.launcher.daemon.client.DaemonConnectionException: The newly created daemon process has a different context than expected. It won't be possible to reconnect to this daemon. Context mismatch: Java home is different.

I've seen other questions about this but none of those solutions are working for me and I've never had this issue before, 10 years of using IDEA on OSX.

enter image description here

enter image description here

like image 527
Gregg Avatar asked May 14 '20 20:05

Gregg


People also ask

How do I reset Gradle sync in IntelliJ?

To sync Gradle project changes to IDEA, you need to click on the Gradle Tool Windows “Refresh” button. Clicks on the “Refresh all Gradle projects” button.

Why is my Gradle project Sync failed?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again. For finding your .

How to sync Gradle changes with IntelliJ IDEA?

Gradle is not sync with IntelliJ IDEA. Make some changes in the build.gradle file, but the changes never apply or sync to the IDEA (Tested with 2016.3) 1. Using IDEA plugin. 2. Make changes and issue the Gradle clean and idea command. All the above Gradle commands do not sync the changes to IDEA.

How do I open a Gradle file in IntelliJ?

Open your project in IntelliJ IDEA. In the Project tool window, right-click the name of your project and select New | File. In the dialog that opens enter build.gradle and click OK. Open the build.gradle file in the editor, add the information you need and re-open your project.

How do I use IntelliJ IDEA without a JDK?

If you don't have a JDK on your machine, IntelliJ IDEA can quickly download the JDK for you. The Gradle project sync will wait until the JDK is downloaded. Click Next. On the next page of the wizard, specify the fields which resemble the Maven coordinates. These settings might be helpful if you decide to deploy your project to a Maven repository.

How do I fix Gradle sync error?

On the "messages Gradle Sync" (bottom window), there is a hyperlink that says Error: "Install Repository and sync project." Click on it. Accept the License Agreement. Post the logs from Event Log window. One possibility could be that the gradle setting file is pointing to a non-existing version of gradle.


1 Answers

The issue is likely caused by the incorrect Java home path specified for the JDK in IntelliJ IDEA. Make sure it points to the correct location like this:

/Users/rob/.sdkman/candidates/java/14.0.1-zulu/zulu-14.jdk/Contents/Home

On macOS /Contents/Home part of the path is significant.

like image 183
CrazyCoder Avatar answered Oct 07 '22 00:10

CrazyCoder