【问题标题】:FAILURE: Build failed with an exception. ‘Error occurred during initialization of VM’ ionicFAILURE:构建失败并出现异常。 'VM 初始化期间发生错误' ionic
【发布时间】:2019-12-07 14:23:54
【问题描述】:

我对 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.

请我花了很多时间试图解决问题,但我无法解决 如果有人知道解决问题,请告诉我

【问题讨论】:

    标签: cordova ionic-framework gradle


    【解决方案1】:

    根据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

    社区版主(不是 Ionic 团队)

    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

    【讨论】:

    • 我没有文件 GradleBuilder.js
    • 我的平台\android\cordova\lib\builders\中有builder.js和ProjectBuilder.js
    【解决方案2】:

    我喜欢卸载 jdk 8.191 然后安装 jdk 8.231

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 2018-10-22
      • 1970-01-01
      • 2018-10-29
      相关资源
      最近更新 更多