Error after using CMD: ionic cordova build android --prod --release

Hello,

I try to generate apk for android but the message error below after using CMD:
ionic cordova build android --prod --release
thanks for your help

D:\plak>ionic cordova build android --prod --release

ionic-app-scripts build --prod --target cordova --platform android
[12:23:20] ionic-app-scripts 3.2.1
[12:23:20] build prod started …
[12:23:20] clean started …
[12:23:21] clean finished in 92 ms
[12:23:21] copy started …
[12:23:21] deeplinks started …
[12:23:21] deeplinks finished in 145 ms
[12:23:21] ngc started …
[12:23:45] ngc finished in 23.62 s
[12:23:45] preprocess started …
[12:23:45] preprocess finished in 3 ms
[12:23:45] webpack started …
[12:23:45] copy finished in 24.74 s
[12:24:31] webpack finished in 46.51 s
[12:24:31] uglify started …
[12:24:31] sass started …
[12:24:36] sass finished in 5.34 s
[12:24:36] cleancss started …
[12:24:43] cleancss finished in 6.62 s
[12:25:11] uglify finished in 39.95 s
[12:25:11] postprocess started …
[12:25:11] postprocess finished in 34 ms
[12:25:11] lint started …
[12:25:11] build prod finished in 111.02 s
[12:25:21] lint finished in 9.53 s
cordova build android --release

You have been opted out of telemetry. To change this, run: cordova telemetry on.
Android Studio project detected
ANDROID_HOME=C:\Users\AKKAOUI\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191
studio
Subproject Path: CordovaLib
Subproject Path: app
Downloading https://services.gradle.org/distributions/gradle-4.1-all.zip

Starting a Gradle Daemon (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/4.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.

  • Get more help at https://help.gradle.org
    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/4.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.

  • Get more help at https://help.gradle.org
    [ERROR] An error occurred while running subprocess cordova.

      cordova build android --release exited with exit code 1.
    
      Re-running this command with the --verbose flag may provide more information.
1 Like

this link well help you :wink: