摘要:今天早上手贱,不知道啥时候电脑上出现个腾讯电脑管家的图标,心想着 既然来了就是缘分,随手就清理下垃圾,点了下优化。然后就卸了。之后打开android studio打算开始工作。可是 项目运行不起来了。

gradle报错

1
2
3
4
5
6
7
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/3.3/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Consult IDE log for more details (Help | Show Log) (7s 617ms)

确实是之前没遇到过,凭经看 看是gradle进程运行不起来,又提示JVM相关错误,心想应该是 那里内存不够了
之后 百度下 ,别说!答案还不少,看来很多人都遇到过这种错误。看了几篇博客,更验证了我的想法,没错 内存的问题。修开访法基本都是
在gradle.properties里添加 org.gradle.jvmargs=-Xmx512m 等等,但是但是但是 我修改后 完全没有用,有点慌了 下午领导还要演示呢 ,怎么办 怎么办。
病急乱投医,卸了as重装,没用
删了gradle 重下,没用
重启电脑,没有
一阵激情过后
——————————————————————————————————

我是不是得看看错误日志,不然在这吓忙活啥,果断找到 .gradle下的 日志文件

看到报错第地方

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
10:38:44.426 [DEBUG] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Advertised daemon context: DefaultDaemonContext[uid=85cf539f-07f3-4690-85c7-5d370f783767,javaHome=C:\Program Files\Android\Android Studio2\jre,daemonRegistryDir=F:\.gradle\daemon,pid=4280,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
10:38:44.427 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Storing daemon address: [4930f1ca-e060-49ef-907d-0fad236aad1c port:49617, addresses:[/127.0.0.1]], context: DefaultDaemonContext[uid=85cf539f-07f3-4690-85c7-5d370f783767,javaHome=C:\Program Files\Android\Android Studio2\jre,daemonRegistryDir=F:\.gradle\daemon,pid=4280,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
10:38:44.438 [ERROR] [system.err]
10:38:44.438 [ERROR] [system.err] FAILURE: Build failed with an exception.
10:38:44.439 [ERROR] [system.err]
10:38:44.439 [ERROR] [system.err] * What went wrong:
10:38:44.439 [ERROR] [system.err] java.net.SocketException: Bad address: Cannot bind
10:38:44.439 [ERROR] [system.err]
10:38:44.439 [ERROR] [system.err] * Try:
10:38:44.439 [ERROR] [system.err] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
10:38:44.440 [ERROR] [system.err]
10:38:44.440 [ERROR] [system.err] * Get more help at https://help.gradle.org
Daemon vm is shutting down... The daemon has exited normally or was terminated in response to a user interrupt.
10:38:44.442 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: [4930f1ca-e060-49ef-907d-0fad236aad1c port:49617, addresses:[/127.0.0.1]]
10:38:44.443 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] VM shutdown hook was unable to remove the daemon address from the registry. It will be cleaned up later.
org.gradle.api.UncheckedIOException: java.net.SocketException: Bad address: Cannot bind
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.cache.internal.FileLockCommunicator.<init>(FileLockCommunicator.java:49)
at org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler.getCommunicator(DefaultFileLockContentionHandler.java:153)
at org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler.reservePort(DefaultFileLockContentionHandler.java:145)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:91)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:79)
at org.gradle.cache.internal.OnDemandFileAccess.updateFile(OnDemandFileAccess.java:45)
at org.gradle.cache.internal.SimpleStateCache.update(SimpleStateCache.java:80)
at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator$1.create(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:46)
at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.doUpdate(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:63)
at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.update(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:43)
at org.gradle.launcher.daemon.registry.PersistentDaemonRegistry.remove(PersistentDaemonRegistry.java:127)
at org.gradle.launcher.daemon.server.Daemon$1.run(Daemon.java:127)
at org.gradle.process.internal.shutdown.ShutdownHookActionRegister$GradleShutdownHook.run(ShutdownHookActionRegister.java:41)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Bad address: Cannot bind
at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method)
at java.net.DualStackPlainDatagramSocketImpl.bind0(DualStackPlainDatagramSocketImpl.java:84)
at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:93)
at java.net.DatagramSocket.bind(DatagramSocket.java:392)
at java.net.DatagramSocket.<init>(DatagramSocket.java:242)
at java.net.DatagramSocket.<init>(DatagramSocket.java:299)
at org.gradle.cache.internal.FileLockCommunicator.<init>(FileLockCommunicator.java:47)
... 13 more

这里面提示 java.net.SocketException: Bad address: Cannot bind

是socket连接上的错误 看到错误地址的端口是 49617,难道是有什么进程 根他冲突了吗,果断 cmd 去查端口,结果是没找到。
继续看日志

1
VM shutdown hook was unable to remove the daemon address from the registry. It will be cleaned up later.

然后 腾讯关机搞我的注册表了吗,排查下,最后也是没看出下什么名堂。
看着表眼看快下午了 等不了了,既然是socket的错误,是不是腾讯管家 搞了我的网络配置。他能搞哪 猜不出来,不管了 恢复下

cmd

1
netsh winsock reset

提示重启电脑生效,重启电脑,启动as,编译通过。

最后就想嘱咐下,好奇害死猫 千万别手贱 去尝试那些 流氓软件