Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JVM error while building Ionic project

When I started building my Android app project I found an error:

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 http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Unrecognized VM option 'MaxPermSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


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

/var/www/html/ionicApp/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: /var/www/html/ionicApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/var/www/html/ionicApp/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /var/www/html/ionicApp/platforms/android/cordova/build: Command failed with exit code 1

I tried what was said in this Stack Overflow answer. Even then, my problem wasn't fixed. Not even after configuring it offline.

When I googled this error I found it's something related to Android Studio, but I am not on Studio. I am confused as this is my first experience with handling a java-related task.

Can anyone suggest how to solve this?

like image 412
amoeba Avatar asked Feb 15 '26 19:02

amoeba


1 Answers

This is a Gradle issue, not really and Android Studio one. The Gradle daemon is used to optimize the build performance. By default it is configured via a properties file /~/.gradle/gradle.properties. You can learn more by reading the first doc link provided in the error message.

The error message tells everything you need to know about the error, in particular:

Unrecognized VM option 'MaxPermSize=256m'

This unrecognized option prevents Gradle from starting the JVM that runs the Gradle dameon. I presume that this option should be -XX:MaxPermSize=256m instead. If no syntax of this option works for you, you can try and disable the daemon by setting in the properties file:

org.gradle.daemon=false

Your build will still run and may be slower - how much slower is impossible to say, it might not even be noticeable.

like image 165
Lolo Avatar answered Feb 18 '26 09:02

Lolo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!