Gradle: Couldn't connect to Kotlin daemon on Windows

Finally, I found the source of the issue ... After some days!

I found out the issue is from my user account. So decided to revert any user-dependent thing to its first state. During clearing Temp folder (in AppData\local\) accidentally I saw these files:

kotlin-daemon.Û²Û°Û±Û¹-Û°Û±-Û°Û¸.Û°Û³-ÛµÛ´-Û±Û²-Û¶Û´Û¸.00.log
kotlin-daemon.Û²Û°Û±Û¹-Û°Û±-Û°Û¸.Û°Û³-ÛµÛ´-Û±Û²-Û¶Û´Û¸.00.log

Yes! The problem has come from unicode encoding issues (probably between NTFS and UTF-8)! Although these are log files and maybe not important their names, this issue can exist somewhere else!

As you can guess, damaged part of file names are date & time. So (unfortunately) I forced to revert my personalizations of Windows user account's date & time formats from my favorite (Persian (Iran)) to English (United States):

enter image description here

And the problem solved immediately:

> wmic process where "name='java.exe'" get processId, executablePath, commandLine /format:list

CommandLine=D:\Devel\JDK\openjdk-11.0.1\bin\java.exe -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx1536m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp D:\Devel\.gradle\wrapper\dists\gradle-5.0-all\4mxuau4c77thx8zlvtz4xiez7\gradle-5.0\lib\gradle-launcher-5.0.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.0
ExecutablePath=D:\Devel\JDK\openjdk-11.0.1\bin\java.exe
ProcessId=9168

CommandLine=D:\Devel\JDK\openjdk-11.0.1\bin\java -cp D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\1.3.10\adc9e577de39fba3db6d60662892118afedd713\kotlin-compiler-embeddable-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-reflect\1.3.10\dd02865be0351707554b16a896b766b2396cdafa\kotlin-reflect-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.3.10\b178c1501609c6e4ee8be635513cb023a466457d\kotlin-stdlib-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-script-runtime\1.3.10\1d2bac36f99b84e1493244f12629bc0756a3ff90\kotlin-script-runtime-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.10\1b19d99229dcedad7caf50534dce38fe82845269\kotlin-stdlib-common-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains\annotations\13.0\919f0dfe192fb4e063e7dacadee7f8bb9a2672a9\annotations-13.0.jar -Djava.awt.headless=true -Djava.rmi.server.hostname=127.0.0.1 -Xmx1536m -XX:MaxPermSize=512m -Dkotlin.environment.keepalive org.jetbrains.kotlin.daemon.KotlinCompileDaemon --daemon-runFilesPath C:\Users\I\AppData\Local\kotlin\daemon --daemon-autoshutdownIdleSeconds=7200 --daemon-compilerClasspath D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\1.3.10\adc9e577de39fba3db6d60662892118afedd713\kotlin-compiler-embeddable-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-reflect\1.3.10\dd02865be0351707554b16a896b766b2396cdafa\kotlin-reflect-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.3.10\b178c1501609c6e4ee8be635513cb023a466457d\kotlin-stdlib-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-script-runtime\1.3.10\1d2bac36f99b84e1493244f12629bc0756a3ff90\kotlin-script-runtime-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.10\1b19d99229dcedad7caf50534dce38fe82845269\kotlin-stdlib-common-1.3.10.jar;D:\Devel\.gradle\caches\modules-2\files-2.1\org.jetbrains\annotations\13.0\919f0dfe192fb4e063e7dacadee7f8bb9a2672a9\annotations-13.0.jar
ExecutablePath=D:\Devel\JDK\openjdk-11.0.1\bin\java.exe
ProcessId=12088

The second process is Kotlin compile daemon.


Also log files:

kotlin-daemon.2019-01-08.03-51-11-111.00.log
kotlin-daemon.2019-01-08.03-51-11-111.00.log.lck

(Note that .log.lck file didn't exist in previous state!)