【问题标题】:Android Studio Unable to start the daemon processAndroid Studio 无法启动守护进程
【发布时间】:2019-07-24 16:03:19
【问题描述】:

Gradle“我的应用程序”项目刷新失败 错误:无法启动守护进程。 此问题可能是由于守护程序配置不正确造成的。 例如,使用了无法识别的 jvm 选项。 请参阅https://docs.gradle.org/4.1/userguide/gradle_daemon.htmlhttps://docs.gradle.org/4.1/userguide/gradle_daemon.html 上有关守护进程的用户指南章节

请阅读以下流程输出以了解更多信息:

-Xmx1536m: illegal argument
usage: java [-options] class

where options include:
    -help             print out this message
    -version          print out the build version
    -v -verbose       turn on verbose mode
    -debug            enable remote JAVA debugging
    -noasyncgc        don't allow asynchronous garbage collection
    -verbosegc        print a message when garbage collection occurs
    -noclassgc        disable class garbage collection
    -ss<number>       set the maximum native stack size for any thread
    -oss<number>      set the maximum Java stack size for any thread
    -ms<number>       set the initial Java heap size
    -mx<number>       set the maximum Java heap size
    -classpath <directories separated by semicolons>
                      list directories in which to look for classes
    -prof[:<file>]    output profiling data to .\java.prof or .\<file>
    -verify           verify all classes when read in
    -verifyremote     verify classes read in over the network [default]
    -noverify         do not verify any class
    -nojit            disable JIT compiler

查看 IDE 日志了解更多详情(帮助 | 显示日志)

【问题讨论】:

  • 这是你的问题。 无法识别的 jvm 选项 -Xmx1536m 阅读 this 了解如何设置它。 (看看你的问题(where options include),看起来 -Xmx1536m 应该是 -mx1536m

标签: android gradle android-gradle-plugin


【解决方案1】:

您可以删除机器上的文件夹~/.gradle 并重新运行构建。

【讨论】:

  • 就我而言,不知何故,在 ~/.gradle 目录中有一个 gradle.properties,它覆盖了所有其他项目的 JVM 参数(就像今天一样,出乎意料)。我摆脱了它,问题就消失了。