Ionic 2 Error Build Android

Hello, i had some problem while i build android.

I already googling for this problem but not solved. Please help me im stuck about 1 week.

Thank you

First Give me Ionic Info and copy build error in code tag…

Hi, @satriantorobimo

you are facing the same issue. pls try solving this way,

Hello @Hardik1705 , this is my ionic info :

cli packages: (C:\Users\bimos\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.3
    Node              : v7.7.3
    npm               : 5.6.0
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : C:\androidsdk

Misc:

    backend : legacy

and this is build error message :

Running app-scripts build: --platform android --target cordova
[14:17:55]  build dev started ...
[14:17:55]  clean started ...
[14:17:55]  clean finished in 14 ms
[14:17:55]  copy started ...
[14:17:55]  deeplinks started ...
[14:17:56]  deeplinks finished in 29 ms
[14:17:56]  transpile started ...
[14:18:02]  transpile finished in 6.21 s
[14:18:02]  preprocess started ...
[14:18:02]  preprocess finished in 1 ms
[14:18:02]  webpack started ...
[14:18:02]  copy finished in 7.17 s
[14:18:09]  webpack finished in 7.27 s
[14:18:09]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find
Browserslist config. Set it to CSS file path or to `undefined` to prevent this w
arning.
[14:18:11]  sass finished in 1.93 s
[14:18:11]  postprocess started ...
[14:18:11]  postprocess finished in 11 ms
[14:18:11]  lint started ...
[14:18:11]  build dev finished in 15.81 s
> cordova build android
Android Studio project detected

ANDROID_HOME=C:\androidsdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_162
studio
Subproject Path: CordovaLib
Subproject Path: app
[14:18:17]  lint finished in 5.75 s
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --stat
us 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 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:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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


* 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
(node:8388) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): 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/
4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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


* 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
(node:8388) DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the Node.js p
rocess with a non-zero exit code.

Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:
Variable name: _JAVA_OPTIONS

Variable value: -Xmx512M

source link : - bug: ionic 2 unable to start daemon process. · Issue #10970 · ionic-team/ionic-framework · GitHub

For This Error Try this some links

1 Like

Still getting this error

Running app-scripts build: --platform android --target cordova
[15:58:30]  build dev started ...
[15:58:30]  clean started ...
[15:58:30]  clean finished in 5 ms
[15:58:30]  copy started ...
[15:58:30]  deeplinks started ...
[15:58:30]  deeplinks finished in 26 ms
[15:58:30]  transpile started ...
[15:58:34]  transpile finished in 3.56 s
[15:58:34]  preprocess started ...
[15:58:34]  preprocess finished in 1 ms
[15:58:34]  webpack started ...
[15:58:34]  copy finished in 3.83 s
[15:58:41]  webpack finished in 7.11 s
[15:58:41]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find
Browserslist config. Set it to CSS file path or to `undefined` to prevent this w
arning.
[15:58:42]  sass finished in 1.02 s
[15:58:42]  postprocess started ...
[15:58:42]  postprocess finished in 9 ms
[15:58:42]  lint started ...
[15:58:42]  build dev finished in 11.87 s
> cordova build android
Android Studio project detected

ANDROID_HOME=C:\androidsdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_162
studio
Subproject Path: CordovaLib
Subproject Path: app
[15:58:47]  lint finished in 5.16 s
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --stat
us 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 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:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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
Picked up _JAVA_OPTIONS: -Xmx512M


* 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
(node:8088) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): 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/
4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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
Picked up _JAVA_OPTIONS: -Xmx512M


* 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
Picked up _JAVA_OPTIONS: -Xmx512M
(node:8088) DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the Node.js p
rocess with a non-zero exit code.

Honestly, i already try this.

Please help me

You are build App in Prod mode or normal mode ?

Im build in normal mode. So, if i create new project when im build android i get this error. Don`t know why i get this error.

@Hardik1705

Read this Doc and check his path and stop gradle and try to build app.
and also try this --no-daemon command line options

ionic cordova build android --no-daemon

https://docs.gradle.org/4.1/userguide/gradle_daemon.html

Hey @Hardik1705 , this is when im using ionic cordova build android --no-daemon :

Running app-scripts build: --platform android --target cordova
[08:28:21]  build dev started ...
[08:28:21]  clean started ...
[08:28:21]  clean finished in 5 ms
[08:28:21]  copy started ...
[08:28:21]  deeplinks started ...
[08:28:21]  deeplinks finished in 26 ms
[08:28:21]  transpile started ...
[08:28:25]  transpile finished in 3.53 s
[08:28:25]  preprocess started ...
[08:28:25]  preprocess finished in 1 ms
[08:28:25]  webpack started ...
[08:28:25]  copy finished in 3.79 s
[08:28:31]  webpack finished in 6.73 s
[08:28:31]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find
Browserslist config. Set it to CSS file path or to `undefined` to prevent this w
arning.
[08:28:33]  sass finished in 1.10 s
[08:28:33]  postprocess started ...
[08:28:33]  postprocess finished in 9 ms
[08:28:33]  lint started ...
[08:28:33]  build dev finished in 11.54 s
> cordova build android
Android Studio project detected

ANDROID_HOME=C:\androidsdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_162
studio
Subproject Path: CordovaLib
Subproject Path: app
[08:28:38]  lint finished in 5.18 s
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --stat
us 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 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:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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
Picked up _JAVA_OPTIONS: -Xmx512M


* 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
(node:7288) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): 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/
4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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
Picked up _JAVA_OPTIONS: -Xmx512M


* 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
Picked up _JAVA_OPTIONS: -Xmx512M
(node:7288) DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the Node.js p
rocess with a non-zero exit code.

And im trying using ionic cordova build android --verbose

[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: 'F:\\NewIonic\\registerfa', local: false, binPath:
        'C:\\Users\\bimos\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ioni
c',
        libPath:
        'C:\\Users\\bimos\\AppData\\Roaming\\npm\\node_modules\\ionic\\dist\\ind
ex.js'
        }
[DEBUG] Daemon found (pid: 7024)
Running app-scripts build: --platform android --target cordova
[08:29:56]  build dev started ...
[08:29:56]  clean started ...
[08:29:56]  clean finished in 5 ms
[08:29:56]  copy started ...
[08:29:56]  deeplinks started ...
[08:29:56]  deeplinks finished in 28 ms
[08:29:56]  transpile started ...
[08:30:00]  transpile finished in 3.39 s
[08:30:00]  preprocess started ...
[08:30:00]  preprocess finished in 1 ms
[08:30:00]  webpack started ...
[08:30:00]  copy finished in 3.63 s
[08:30:05]  webpack finished in 4.93 s
[08:30:05]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find
Browserslist config. Set it to CSS file path or to `undefined` to prevent this w
arning.
[08:30:06]  sass finished in 1.11 s
[08:30:06]  postprocess started ...
[08:30:06]  postprocess finished in 9 ms
[08:30:06]  lint started ...
[08:30:06]  build dev finished in 9.62 s
> cordova build android
Android Studio project detected

ANDROID_HOME=C:\androidsdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_162
studio
Subproject Path: CordovaLib
Subproject Path: app
[08:30:11]  lint finished in 5.09 s
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --stat
us 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 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:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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
Picked up _JAVA_OPTIONS: -Xmx512M


* 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
(node:10276) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje
ction id: 1): 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/
4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ClassLoaderRegistry using GlobalScopeServices.c
reateClassLoaderRegistry().

* 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
Picked up _JAVA_OPTIONS: -Xmx512M


* 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
Picked up _JAVA_OPTIONS: -Xmx512M
(node:10276) DeprecationWarning: Unhandled promise rejections are deprecated. In
 the future, promise rejections that are not handled will terminate the Node.js
process with a non-zero exit code.

Please help me @Hardik1705 im really stuck

Thank you

and

try this link i hope it’s time solve your problem…

Hello @Hardik1705 my problem is still stuck, please help me

I struggled with the same issue!

My solution was:

Setup your Environment Variables. (If you already setted up those ignore it).

ANDROID_HOME
grafik

ANDROID_SDK (same path as android_home)
grafik

Path (from java)
grafik

!REMOVE!
Variable name: _JAVA_OPTIONS

Variable value: -Xmx512M


Next thing you want to check out is this link.

How you install it on windows:

Use Chocolatey

https://chocolatey.org/install

Just type this into your cmd


@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

It will automaticly download and install all files.

Next thing is now we want to install Gradle.

Type this into your cmd

choco install gradle

Test it out:

gradle -v


I gues that is all you have todo I hope I didn’t forgot anything please post your result!

Good luck :bird::slight_smile:

1 Like

This fixed my issue, thank you!

1 Like

Thank You so much… It worked for me