Gradle sync failed: Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.

最近做项目的时候忽然间出现这么个异常

Gradle sync failed: Unable to start the daemon process.

This problem might be caused by incorrect configuration of the daemon.

For example, an unrecognized jvm option is used.

Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html

Please read the following process output to find out more:

-----------------------

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Consult IDE log for more details (Help | Show Log)

首先声明,我没有改任何东西,这个bug是忽然出现的,百度了下解决方案,在这里说一下百度里面是真的有很多没什么卵用的方法。也因此我绕了很多远路。首先看看Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0这句话,其实这个没什么影响。但是可以通过如下两种方式得到解决,1.在gradle.properties里写入org.gradle.jvmargs=-Xmx512m或者更大的值,2.在你的c盘下的.gradle文件夹中找到gradle.properties文件没有就新建一个,再写入org.gradle.jvmargs=-Xmx512m  (这个512还可以大一点,视自己内存而定)。这个只能消除分割线下面部分,上面部分错误仍然存在。我试过很多方法包括重装jdk,sdk,studio均无法解决。后面通过分析log,发现gradle编译过程中就出现问题了,但是gradle的错误在这个log中是无法发现的(Android studio的锅)那么怎么查看gradle的错误
运行CMD,进入项目根目录执行命令 gradlew compileDebug --stacktrace  也可在AS的Terminal中输入

出现如下错误

java.net.SocketException: Unrecognized Windows Sockets error: 10106: create

at java.net.ServerSocket.createImpl(ServerSocket.java:307)

at java.net.ServerSocket.getImpl(ServerSocket.java:257)

at java.net.ServerSocket.bind(ServerSocket.java:375)

at java.net.ServerSocket.(ServerSocket.java:237)

at org.apache.catalina.core.StandardServer.await(StandardServer.java:441)

at org.apache.catalina.startup.Catalina.await(Catalina.java:758)

at org.apache.catalina.startup.Catalina.start(Catalina.java:704)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)

这下可以说的通了为什么换了studio和sdk都没用,其实这个bug和Android关系不大,是java在网络层的问题。

解决方案:1,以管理员身份打开命令提示符

2,输入netsh winsock reset

3,重启电脑就ok了

winsock是Windows网络编程接口,winsock工作在应用层,它提供与底层传输协议无关的高层数据传输编程接口 netsh winsock reset 是把它恢复到默认状态

重启项目ok搞定!

参考来自https://www.cnblogs.com/xxdotnet/p/4359896.html

http://blog.csdn.net/feilong2483/article/details/78682205

你可能感兴趣的:(Gradle sync failed: Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.)