“Starting Gradle daemon” loop creating endless processes

南楼画角 提交于 2020-12-05 11:51:06

问题


Whenever I open or create a project in Android Studio, and it starts to do its background build or whatever, it gets to "Starting Gradle daemon", but gets in a loop and never stops repeating that step. As a result, the build never finishes and it keeps creating Gradle daemon processes until the system runs out of memory and freezes.

This is in Ubuntu. It did work previously, and I don't know what could have changed to make it start happening. Has anyone else run into this problem and been able to fix it?


回答1:


I had the same problem on Linux. I traced it down to a firewall misconfiguration. It prevented Android Studio from communicating with Gradle daemon using IP over loopback interface.




回答2:


The cause in my case was the Windows Mobile Hotspot feature (aka, adHoc Adapter or Wi-Fi Direct Virtual Adapter).

For some reason, while the hotspot is on, gradle server cannot accept incoming connections from /127.0.0.1 as per the log file in %userProfile%\.gradle\daemon\<version>\. And so, it keeps spawning new daemons thinking the old ones (sleeping in wait for connections) are dead.

As soon as I disabled the hotspot, the next build worked. The curious thing was that after I re-enabled it, gradle build continued to work.

This problem started only after upgrading from AS 4.0 to 4.1 and stayed for the next upgrades too.




回答3:


I have same Error on Win 10, I searched a lot but nothing helped me.

  • I off/on window firewall, defender, edit rules ...etc. no result

Solution is (may be)

restore all firewall settings.

old style Control Panel → System & Safety → Windows Defender → Restore Defaults

Note: options/words may not very similar, because it translated.


Update 1:

Other solution

is run Build before connect PC to internet, then after Daemon started connect to network, and builds will work fine.

or you can try disabling Daemon, or let it work offline.

I hope this could help someone.



来源:https://stackoverflow.com/questions/51270652/starting-gradle-daemon-loop-creating-endless-processes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!