简体   繁体   English

错误:无法使用Android应用程序(ionic,cordova和java应用程序)启动守护进程,并且出现gradle错误

[英]Error : Unable to start the daemon process using android application(ionic,cordova and java application)with gradle error

ANDROID_HOME=C:\\Users\\manish\\AppData\\Local\\Android\\sdk JAVA_HOME=C:\\Program Files (x86)\\Java\\jdk1.8.0_121 Subproject Path: CordovaLib To honour the JVM settings for this build a new JVM will be forked. ANDROID_HOME = C:\\ Users \\ manish \\ AppData \\ Local \\ Android \\ sdk JAVA_HOME = C:\\ Program Files(x86)\\ Java \\ jdk1.8.0_121子项目路径:CordovaLib要遵守此构建的JVM设置,将使用新的JVM分叉。 Please consider using the daemon: https://docs.gradle.org/3.3/userguide/gradle_daemon.html . 请考虑使用守护程序: https : //docs.gradle.org/3.3/userguide/gradle_daemon.html

FAILURE: Build failed with an exception. 失败:构建失败,发生异常。

  • What went wrong: Unable to start the daemon process. 出了什么问题:无法启动守护进程。 This problem might be caused by incorrect configuration of the daemon. 此问题可能是由守护程序的错误配置引起的。 For example, an unrecognized jvm option is used. 例如,使用了无法识别的jvm选项。 Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html 请参阅守护程序上的用户指南一章, 网址https://docs.gradle.org/3.3/userguide/gradle_daemon.html

    Please read the following process output to find out more: 请阅读以下过程输出以了解更多信息:

Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap VM初始化期间发生错误无法为1572864KB对象堆保留足够的空间

  • Try: Run with --stacktrace option to get the stack trace. 尝试:使用--stacktrace选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. 使用--info或--debug选项运行以获取更多日志输出。 (node:4316) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception. (节点:4316)UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝ID:1):错误:cmd:命令失败,退出代码为1错误输出:FAILURE:构建失败,并带有异常。

// find the file gradlebuilder.js //找到文件gradlebuilder.js

// It should be here in your application Drive:\\"your Application path"\\platforms\\android\\cordova\\lib\\builders //它应该在您的应用程序驱动器中:\\“您的应用程序路径” \\ platforms \\ android \\ cordova \\ lib \\ builders

GradleBuilder.prototype.getArgs = function(cmd, opts) {
if (cmd == 'release') {
    cmd = 'cdvBuildRelease';
} else if (cmd == 'debug') {
    cmd = 'cdvBuildDebug';
}
var args = [cmd, '-b', path.join(this.root, 'build.gradle')];
if (opts.arch) {
    args.push('-PcdvBuildArch=' + opts.arch);
}

// 10 seconds -> 6 seconds
args.push('-Dorg.gradle.daemon=false');

// to solve gradle Error occurred during initialization of VM //Could not reserve enough space for 1572864KB object heap then we need to some changes in this code // args.push(('-Dorg.gradle.daemon=true');) // to allow dex in process with this code args.push('-Dorg.gradle.jvmargs=-Xmx1024m'); //解决gradle错误在VM初始化期间发生错误//无法为1572864KB对象堆保留足够的空间,那么我们需要对该代码进行一些更改// // args.push(('-Dorg.gradle.daemon = true'); ) //以该代码args.push('-Dorg.gradle.jvmargs = -Xmx1024m')允许dex处理 args.push('-Dorg.gradle.jvmargs=-Xmx1536m'); args.push('-Dorg.gradle.jvmargs = -Xmx1536m');

// allow NDK to be used - required by Gradle 1.5 plugin
args.push('-Pandroid.useDeprecatedNdk=true');
args.push.apply(args, opts.extraArgs);
// Shaves another 100ms, but produces a "try at own risk" warning. Not worth it (yet):
// args.push('-Dorg.gradle.parallel=true');
return args;`enter code here`

}; };

Note : 1. to allow dex in process with this code args.push('-Dorg.gradle.jvmargs=-Xmx1024m'); 注意:1.使用此代码args.push('-Dorg.gradle.jvmargs = -Xmx1024m')允许dex处理; 2. args.push(('-Dorg.gradle.daemon=true');) 2. args.push(('-Dorg.gradle.daemon = true');)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM