Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea Android project: Gradle project sync failed [duplicate]

EDIT:

The solution prompted by @Percy Vega on this post worked for me.

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


I've never used Gradle, so I'm pretty confused right now: I've been trying for a while now to get this to work, but without any success. I'm 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

On 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've downloaded Gradle 3.3 and stored it at:

C:\Program Files\Gradle\gradle-3.3

Here are the Gradle setting, inside of IntelliJ. Iv'e also tried to check 'Offline Work', but it gives the same result:

enter image description here

The project root's build.gradle file:

enter image description here

And the app´s build.gradle file:

enter image description here

How can I manage to fix this? Thanks in advance.

PS: If any more information would be useful please just ask.

like image 461
Francisco Avatar asked Oct 30 '22 14:10

Francisco


1 Answers

One specifies the version of Gradle inside a gradle-wrapper.properties file, whose contents look like this:

#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 is:

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

Then, AS downloads it and typically installs it (on a Windows machine) to:

C:\Users\<username>\.gradle\wrapper\dists\gradle-<version>-all
like image 164
Dev-iL Avatar answered Nov 02 '22 22:11

Dev-iL