How to build Ionic for android?

Help,

How to solve this error?

Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser

[11:37:08] build dev started …
[11:37:08] clean started …
[11:37:08] clean finished in 31 ms
[11:37:08] copy started …
[11:37:08] transpile started …
[11:37:20] transpile finished in 11.83 s
[11:37:20] preprocess started …
[11:37:20] deeplinks started …
[11:37:20] deeplinks finished in 32 ms
[11:37:20] preprocess finished in 41 ms
[11:37:20] webpack started …
[11:37:23] copy finished in 15.04 s
[11:37:49] webpack finished in 29.11 s
[11:37:49] sass started …
[11:37:55] sass finished in 5.46 s
[11:37:55] postprocess started …
[11:37:55] postprocess finished in 16 ms
[11:37:55] lint started …
[11:37:55] build dev finished in 46.68 s

cordova build android
\ Running command [11:38:04] lint finished in 9.58 s
:heavy_multiplication_x: Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    ANDROID_HOME=C:\Users\Chit Oo Naung\AppData\Local\Android\sdk
    JAVA_HOME=C:\Program Files (x86)\java\jdk1.8.0_45
    Subproject Path: CordovaLib
    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/3.3/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/3.3/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.

Sounds like you’re out of memory.

Thanks for reply,
How can I solve this ‘out of memory’?

Get more memory or stop other stuff that uses memory.

9 posts were split to a new topic: > No installed build tools found. Install the Android build tools version 19.1.0 or higher

You can solve this problem by simply changing argument -Xmx20484m to 1024 at line:

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

in your project file platforms\android\cordova\lib\builders\GradleBuilder.js.

1 Like

tq! it’s working for me. but what exactly this line do?