Ionic build android app error

Hello all,
I am having error building my app, I have tried all I know. Please I need help

cordova.cmd build android
[Gradle Properties] Detected Gradle property “org.gradle.jvmargs” with the value of “-Xmx1536m to org.gradle.jvmargs=-Xmx1024m”, Cordova’s recommended value is “-Xmx2048m”
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\name\AppData\Local\Android\Sdk (DEPRECATED)
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
    Please read the following process output to find out more:

Error: Could not find or load main class to

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at
    C:\Program Files\Android\Android Studio\gradle\gradle-5.1.1\bin\gradle: Command failed with exit code 1
    [ERROR] An error occurred while running subprocess cordova.

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

See my ionic info below

C:\Users\name>ionic info
[ERROR] Error loading @ionic/angular package.json: Error: Cannot find module ‘@ionic/angular/package’
[ERROR] Error loading @ionic/angular-toolkit package.json: Error: Cannot find module ‘@ionic/angular-toolkit/package’
[ERROR] Error loading @angular-devkit/build-angular package.json: Error: Cannot find module


Ionic CLI : 5.2.2
Ionic Framework : not installed
@angular-devkit/build-angular : not installed
@angular-devkit/schematics : 8.1.1
@angular/cli : 8.1.1
@ionic/angular-toolkit : not installed


Cordova CLI : not installed
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)


cordova-res : not installed
native-run : not installed


Android SDK Tools : 26.1.1 (C:\Users\PstGibson\AppData\Local\Android\Sdk)
NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10

Hi, I too faced this issue today and solved.

For me,
executing below commands one by one from terminal inside the project directory worked out.

export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$HOME/Documents/gradle-5.6.1/bin

And for your other errors regarding angular package errors,remove their version from package.json,uninstall and re-install them.

change below in package.json:
@angular-devkit/build-angular”: “^0.801.2”

npm uninstall
npm i

Do same for other packages.

1 Like