运行gradlew assembleRelease时出现内存不足错误-react-native

问题描述 投票:1回答:1

在为我的本机项目进行发布构建时出现此错误:

Expiring Daemon because JVM heap space is exhausted

> Task :app:transformDexArchiveWithDexMergerForRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForRelease'.
> java.lang.OutOfMemoryError (no error message)

进行了一些研究并进行了一些更改,如下:

  1. android:largeHeap="true"添加到AndroidManifest.xml中的应用程序标签中
  2. 已添加

    dexOptions {javaMaxHeapSize“ 4g”}在android / app / build.gradle文件中。

仍然无法消除此错误。任何永久性的方法来摆脱此错误,以及它是怎么引起的?

java react-native out-of-memory react-native-android
1个回答
0
投票

配置gradle.properties:

org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
© www.soinside.com 2019 - 2024. All rights reserved.