android -xmx,关于android:jvmargs = -xmx2048m dex正在处理cordova
科尔多瓦建立告诉我以下To run dex in process, the Gradle daemon needs a larger heap. Itcurrently has approximately 910 MB. For faster builds, increase themaximum heap size for the Gradle daemon to more than 2048
科尔多瓦建立告诉我以下
To run dex in process, the Gradle daemon needs a larger heap. It
currently has approximately 910 MB. For faster builds, increase the
maximum heap size for the Gradle daemon to more than 2048 MB. To do
this set org.gradle.jvmargs=-Xmx2048M in the project
gradle.properties. For more information see
https://docs.gradle.org/current/userguide/build_environment.html
如何在cordova中将jvmargs设置为-xmx2084M? 是否可以通过config.xml还是必须使用钩子?
干杯和谢谢
琼
琼
您需要在platforms/android文件夹中放置一个名为build-extras.gradle的文件。 Cordova将自动读取文件并为您加载配置。
您可以手动执行此操作,也可以通过挂钩执行此操作。 第一种选择的问题是,如果您删除平台文件夹,也会被删除。
文件内容指定最大堆大小:
android {
dexOptions {
javaMaxHeapSize"2048m"
}
}
如果要使用hook选项,则其内容应如下所示:
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var rootdir = process.argv[2];
if(fs.existsSync(rootdir + '/platforms/android')){
console.log('Add build-extras.gradle');
fs.createReadStream(rootdir + '/build-extras.gradle').pipe(fs.createWriteStream(rootdir + '/platforms/android/build-extras.gradle'));
}
并且您需要将文件放在hooks/after_prepare/文件夹中。 这将自动运行您的钩子。
谢谢! 这看起来是正确的,在issue.apache.org/jira/browse/CB-10096上存在一个问题,应该解决该问题,但对我来说它不起作用,该更改是否已发布?
在启动gradle守护程序之前,尝试设置此环境变量
export GRADLE_OPTS=-Xmx2g
编辑
等待..为什么您不能只按照消息说的做?
set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties
更多推荐
所有评论(0)