Add the printProperties
task to your build.gradle
Run from both the command-line and intellij the gradle task printProperties
> Task :printProperties
Detecting what could cause incompatible gradle daemons
Run './gradlew printProperties' from the command-line and the same task Android studio
See https://docs.gradle.org/4.5/userguide/build_environment.html
See https://docs.gradle.org/4.5/userguide/gradle_daemon.html#daemon_faq
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
org.gradle.java.home=null
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -Duser.country=DE
file.encoding=UTF-8
user.country=DE
user.language=en
java.io.tmpdir=/var/folders/4c/176bjfgn2fj9xp68ckjpz2940000gs/T/
user.variant=
If you have incompatible daemons, you should see something like this
$ ./gradlew --status
PID STATUS INFO
42713 IDLE 4.5
42195 IDLE 4.5
$ ps auxw | grep 'GradleDaemon'
jmfayard 42713 0.0 4.0 10257468 677436 ?? Ss 11:29AM 0:32.29 /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Xmx4g -Dfile.encoding=UTF-8 -Duser.country=DE -Duser.language=en -Duser.variant -cp /Users/jmfayard/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4/gradle-4.5/lib/gradle-launcher-4.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.5
jmfayard 42195 0.0 8.2 10387328 1372144 ?? Ss 11:08AM 2:56.25 /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java -Xmx4g -Dfile.encoding=UTF-8 -Duser.country=DE -Duser.language=en -Duser.variant -cp /Users/jmfayard/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4/gradle-4.5/lib/gradle-launcher-4.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.5
A big reason why the reasons are incompatible is that a different JDK is used.
This can be fixed by having the same value in the JAVA_HOME environment variable and in the Project Structure
dialog
// $HOME/.bash_config
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
Other incompatibilities can be fixed by updating gradle.properties
until the task printProperties
output the same value from both android studio and intellij.
Many thanks for this invaluable task, it helped me debug the daemon differences! I've converted it to kotlin and also updated the links: