增加gradle堆大小

Vik*_*ngh 4 android build heap-memory android-studio android-gradle-plugin

每当我尝试构建应用程序时,gradle会花费太多时间,并且会显示一条消息,表明您应该将Gradle大小增加到3072 MB,目前它是910 MB.所以我的问题是如何增加gradle的堆内存?

M D*_*M D 10

只需添加

 android {
 ....
 dexOptions {
    // Prevent OutOfMemory with MultiDex during the build phase
    javaMaxHeapSize "4g"
  }
}
Run Code Online (Sandbox Code Playgroud)

在你的build.gradle文件中