如何自动设置gradle.properties

时间:2016-04-06 20:33:36

标签: android android-gradle default

通常当我创建一个新项目时,我首先在Android尝试构建Gradle时出现此错误:

Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
<em>org.gradle.jvmargs=-Xmx1024m</em>
<a href="http://www.gradle.org/docs/current/userguide/build_environment.html">Read Gradle's configuration guide</a><br><a href="http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html">Read about Java's heap size</a>

这很容易解决;您只需转到app模块中的gradle.properties,然后在最后一行添加:

org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m

好吧好看。你可能会问,问题是什么?我的问题是我每次都必须这样做!我每次打开记事本时都会保存上面的句子然后复制粘贴。这有点荒谬了。有没有什么办法可以在每次创建新项目时默认gradle.properties包含上面的行?谢谢你的帮助!

BTW :这是Android Studio

0 个答案:

没有答案