这是一个在项目中Module打包出一个JAR包时出现的错误:

错误信息:

Microsoft Windows [版本 10.0.18363.959]
(c) 2019 Microsoft Corporation。保留所有权利。

D:\serviceT>gradlew makeJar
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
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.6/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 1572864KB object heap

* Try:
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.

* Get more help at https://help.gradle.org

 仔细看错屋信息找到关键的信息:Could not reserve enough space for 1572864KB object heap  就是这一句翻译就是:无法为1572864KB的对象堆预留足够的空间。没有足够的控件。

我的解决办法:

看图:找到项目中 gradle.properties里的 org.gradle.jvmargs=-Xmx1536m

AndroidStudio之FAILURE: Build failed with an exception_sed

然后更换为: org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

如图:

AndroidStudio之FAILURE: Build failed with an exception_ide_02

这样将空间扩大得到解决。 


                                                                                                                                                                       -END