失败:构建失败,发生异常。 “ VM初始化期间发生错误”离子

时间:2019-12-07 14:23:54

标签: cordova ionic-framework gradle

我对Ionic框架很陌生

npm install -g cordova

npm install -g ionic

ionic start test blank

cd test

ionic platform add android

这是我的离子信息:

Ionic:

   Ionic CLI                     : 5.4.8 (C:\Users\user\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.11.5
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.1.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : 0.3.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\user\AppData\Local\Android\Sdk)
   NodeJS            : v13.1.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.12.1
   OS                : Windows 7

当我使用‘> ionic build android’ 和繁荣我得到一个错误。

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\user\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\user\AppData\Local\Android\Sdk (DEPRECATED)
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

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.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.0.1/userguide/gradle_daemon.html
Process command line: C:\Program Files (x86)\Java\jdk1.8.0_191\bin\java.exe -Xmx2048m -Dfile.encoding=windows-1252 -Duser.country=FR -Duser.language=fr -Duser.variant -cp C:\Program Files\gradle-6.0.1\lib\gradle-launcher-6.0.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.0.1
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
C:\Program Files\gradle-6.0.1\bin\gradle: Command failed with exit code 1
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android --release exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

请问我花了很多时间尝试解决问题,但我解决不了 如果有人知道要解决问题,请告诉我

2 个答案:

答案 0 :(得分:0)

根据 sky007

这个 https://forum.ionicframework.com/t/ionic-cordova-build-android-fails/102638/2

line:args.push(’-Dorg.gradle.jvmargs=-Xmx1024m’); 

在您的项目文件中,

platforms\android\cordova\lib\builders\GradleBuilder.js

也在此主题中(Ionic Framework论坛)

Sujan12

社区主持人(非离子小组)

https://forum.ionicframework.com/t/error-when-i-build-my-apk-file/138153/5

尝试增加 RAM

如果没有帮助检查此问题

Cordova Could not reserve enough space for 2097152KB object heap

答案 1 :(得分:0)

我受卸载jdk 8.191的影响,然后安装了jdk 8.231