How to increase maximum heap size for the Gradle daemon?

前端 未结 5 1033
孤街浪徒
孤街浪徒 2021-02-20 07:41

When signin an apk, I got this message:

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the m         


        
5条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 08:13

    If you don't have gradle.properties then go to your project folder you will find gradle files there create a text file and name it as gradle.properties removing .txt and then add the below code to that file.

    # 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
    

    and save it then open your project in Android Studio and click on sync now.

    I hope it will resolve your issue, if not please let me know.

提交回复
热议问题