gpt4 book ai didi

android - 如何增加 Gradle 守护程序的最大堆大小?

转载 作者:行者123 更新时间:2023-12-03 02:40:47 30 4
gpt4 key购买 nike

签署 apk 时,我收到以下消息:

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 4608 MB (based on the dexOptions.javaMaxHeapSize = 4g).
To do this set org.gradle.jvmargs=-Xmx4608M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
在我的项目中,我没有 gradle.properties 文件,但我有一个名为 gradle-wrapper.properties 的文件。
我打开该文件并添加了 org.gradle.jvmargs=-Xmx4608M 行.
之后,我尝试再次签署 apk,但我仍然收到增加 Gradle 堆大小的消息。
如何做到这一点?

最佳答案

如果您没有 gradle.properties然后转到您的项目文件夹,您将在那里找到 gradle 文件创建一个文本文件并将其命名为 gradle.properties删除 .txt然后将以下代码添加到该文件中。

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

并保存它,然后在 Android Studio 中打开您的项目,然后单击立即同步。

我希望它能解决您的问题,如果没有,请告诉我。

关于android - 如何增加 Gradle 守护程序的最大堆大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47454257/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com