我正在尝试建立一个IONIC项目,但我面临这个例外,我无法为此调试解决方案。我尝试了很多建议,但没有解决方案。我在等待你的帮助
1-ionic start test4 tabs
2-cd test4
3-ionic platform add android
4-ionic build android
错误
C:\Users\onurr\test4>ionic build android
Running command: "C:\Program Files\nodejs\node.exe"
C:\Users\onurr\test4\hooks\after_prepare\010_add_platform_class.js
C:\Users\onurr\test4
add to body class: platform-android
ANDROID_HOME=C:\Users\onurr\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_112
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
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 guide chapter on the daemon at https://docs.gradle.org/2.14.1/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 2097152KB object heap
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
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 guide chapter on the daemon at https://docs.gradle.org/2.14.1/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 2097152KB object heap
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
答案 0 :(得分:4)
我假设您正在使用Windows查看堆栈跟踪。
在堆栈跟踪中注意此消息:
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
这通常在您拥有32位JVM时发生。如果您的操作系统是64位,请将32位JVM替换为64位JVM。它具有更高的堆约束并将解决问题。这是推荐的解决方案。
请阅读此oracle documentation了解详情。
如果您的操作系统是32位,请尝试按以下方式设置操作系统,然后重新发出ionic build android
命令(可能需要重新启动命令提示符):
转到Start
→Control Panel
→System
→Advanced System Settings
→Advanced (tab)
→Environment Variables
→System Variables
→{{1 }}:
New