React Native Android 项目使用 ./gradlew assembleRelease
命令打包报错 Gradle build daemon has been stopped: JVM garbage collector thrashing and after running out of JVM memory
控制台报错截图如下
项目在昨天之前一直都是可以正常打 release 包的,环境也没有变化,只是提交了少量业务代码,通过删除 build 文件,执行 ./gradlew clean
命令后重新打包也失败
解决方式
在 gradle.properties
文件中添加 org.gradle.jvmargs=-Xmx4096M
配置即可
org.gradle.jvmargs=(JVM arguments)
Specifies the JVM arguments used for the Gradle Daemon. The setting is particularly useful for configuring JVM memory settings for build performance. This does not affect the JVM settings for the Gradle client VM. The default is -Xmx512m "-XX:MaxMetaspaceSize=256m"
.
参考链接
stackoverflow.com/questions/5…