IntelliJ Idea Android Project: Gradle Failed to Sync Project

EDIT:

The solution suggested by @Percy Vega on this one worked for me.

Running idea64.exe instead of idea.exe when you have a 64 bit JRE seems to do the trick.


I never used Gradle, so I'm pretty confused right now: I've been trying to get this to work for a long time, but without any success. I am trying to create an Android project in IntelliJ Idea 2016.3.2 , but as soon as I create it, I get this message:

enter image description here

In the message log:

Gradle sync started Gradle sync failed: 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. Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.1\jre,daemonRegistryDir=C:\Users\xico\.gradle\daemon,pid=5660,idleTimeout=null,daemonOpts=-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant] Actual: DefaultDaemonContext[uid=08e53ecc-a9ee-405c-afc9-a7ba8779d6ee,javaHome=C:\Program Files\Java\jdk1.8.0_112,daemonRegistryDir=C:\Users\xico\.gradle\daemon,pid=2336,idleTimeout=60000,daemonOpts=-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant] Consult IDE log for more details (Help | Show Log) 

I downloaded Gradle 3.3 and saved it at:

 C:\Program Files\Gradle\gradle-3.3 

Below is the Gradle parameter inside IntelliJ. Iv'e also tried to test "battery life", but it gives the same result:

enter image description here

Root build.gradle file :

enter image description here

And the build.gradle application file :

enter image description here

How can i fix this? Thanks in advance.

PS: If you need more information, just ask.

+5
source share
2 answers

One indicates the version of Gradle inside the gradle-wrapper.properties file, the contents of which are as follows:

 #Thu Oct 06 00:21:08 IDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 

Assuming your project structure:

 my-project |- app |+ libs |+ src |- gradle |- wrapper |- gradle-wrapper.properties << here 

Then AS downloads it and usually installs it (on a Windows machine):

 C:\Users\<username>\.gradle\wrapper\dists\gradle-<version>-all 
+1
source

Regarding your error, Java home is different . This is some configuration issue that you have in the OS / application, and not in Android, Gradle.


Anyway

 classpath 'com.android.tools.build:gradle:3.3.0' 

This line does not match the version of Gradle. This is the Android Gradle build library. Starting with this post, 3.3.0 not a valid version .

It is also worth mentioning that although the Android docs say that Gradle 2.14.1 and higher will work, be careful that at some point there may potentially be some violations.


Some other posts I replied regarding this type of Gradle problem

What is the difference between application dependency and module dependency / plugin?

Fix plugin version and synchronization project Error in Android Studio

+1
source

Source: https://habr.com/ru/post/1262755/


All Articles