- Could you tell how I can increase java heap size if I'm using Visual Studio for cordova application build?
您可以按照Could not create Java Virtual Machine error
科TACO Official Document的步驟來增加JVM堆大小。
- Also could you tell how to increase the maximum heap size for the Gradle? I'd like to increase build speed.
要加快構建動作,可以project folder\platform\android\
下添加以下屬性到Gradle.properties
文件:
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
在Corodva項目,平臺文件夾下的變化將通過每個生成被overrided。所以最好是寫一個before_build
鉤將文件複製到Android平臺:
var fs = require('fs');
var Q;
module.exports = function (context) {
Q = context.requireCordovaModule('q');
var defered = Q.defer();
var path = context.opts.projectRoot;
try {
fs.createReadStream(path + '\\myconfigs\\gradle.properties').pipe(fs.createWriteStream(path + '\\platforms\\gradle.properties'));
} catch (e) {
console.log(e);
}
console.log("afterBuild==>End");
defered.resolve();
}
我創建Gradle.properties
下Project Folder\myconfigs
文件夾:
感謝您詳細的解答。我試圖將_JAVA_OPTIONS變量設置爲-Xmx2048M。在此之後,我收到以下錯誤:「未能運行」javac -version「,請確保您已安裝JDK」。 –
您可以請嘗試覆蓋您的jdk文件夾的jdk環境路徑。你可以在'Tools-> Options-> Tools for Apache Cordova-> Environment Variable Overrides'下找到該設置, –
是的。它被覆蓋。我正在使用以下路徑:C:\ Program Files(x86)\ Java \ jdk1.8.0_101 –