卡在启动Gradle守护程序中

时间:2018-07-13 14:24:41

标签: android android-studio gradle daemon

我是一名Android开发人员。 昨天我在Android Studio中打开了当前的项目 并且项目无法启动。

显示错误:

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/4.4/userguide/gradle_daemon.html
        Please read the following process output to find out more:
        -----------------------
        Consult IDE log for more details (Help | Show Log) (4s 245ms)
  • 我已经将graddle.properties编辑为org.gradle.jvmargs=-Xmx1024m,但仍然无法正常工作
  • 我已经使用其gradle重新安装了android studio,但此错误仍然存​​在
  • 我已经删除了计算机上的.gradle文件夹,但仍然卡住了
  • 我已经在Android Studio中设置了构建过程堆的大小,但仍然无法使用
  • 我已经检查了防病毒软件和防火墙(甚至将其关闭),但没有任何反应

我在这里需要帮助,因为我根本无法运行我的项目。

这是gradle日志:

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Caused by: org.gradle.api.GradleException: 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/4.4/userguide/gradle_daemon.html
Please read the following process output to find out more:

这是来自守护程序日志的日志

20:37:16.805 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Microsoft Wi-Fi Direct Virtual Adapter-QoS Packet Scheduler-0000
20:37:16.805 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Microsoft Wi-Fi Direct Virtual Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
20:37:16.806 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
20:37:16.808 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
20:37:16.808 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Microsoft Wi-Fi Direct Virtual Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
20:37:16.814 [ERROR] [system.err] 
20:37:16.814 [ERROR] [system.err] FAILURE: Build failed with an exception.
20:37:16.815 [ERROR] [system.err] 
20:37:16.815 [ERROR] [system.err] * What went wrong:
20:37:16.815 [ERROR] [system.err] java.net.BindException: Address already in use: bind
20:37:16.815 [ERROR] [system.err] 
20:37:16.815 [ERROR] [system.err] * Try:
20:37:16.815 [ERROR] [system.err] Run with --stacktrace option to get the
stack trace. Run with --info or --debug option to get more log output. Run
with --scan to get full insights.
20:37:16.816 [ERROR] [system.err] 
20:37:16.816 [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.

4 个答案:

答案 0 :(得分:1)

启动您的本地 VPN 应用(例如 1.1.1.1)

答案 1 :(得分:0)

  1. 检查任何gradle文件中是否有类似的内容:

    jvmArgs('someValues')
    
  2. 转到您的项目配置:

enter image description here

转到“编辑配置”。确保选择“应用”。

enter image description here

检查启动标志。全部删除>:D

  1. 清理并重建项目

  2. 您(或程序)可能已更改了jvm的默认运行选项。 如果您足够绝望,请尝试在JVM中更改它们或重新安装Java和jdk。

让我知道怎么回事

答案 2 :(得分:0)

进入您的主目录并找到.gradle文件夹。在该文件夹下,我删除了2个文件夹以消除此问题。我删除了.gradle/daemons.gradle/caches目录。一旦我删除了这两个目录并重新启动了Intellij / Android Studio,gradle同步就开始起作用。

在Mac / Linux上

cd ~/.gradle
rm -fr caches daemon

答案 3 :(得分:0)

我通过在我的电脑上打开热点解决了这个问题。找到解决方案 here