2

I can't run my Ionic app on my android device and can't build apk.

I can build and run another app for android on same pc. But I can't build new apps. I stuck at this error.

I tried,

  • GradleBuilder.js --> 2048m to 512m
  • I add to “Environment Variables” _JAVA_OPTIONS -Xmx512M
  • I reinstall gradle 4.6

Sorry for bad english btw. Thanks for help!

    PS D:\Projects\Ionic3\AuthServiceEx> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\[USERNAME]\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_181
studio
Subproject Path: CordovaLib
Subproject Path: app
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
Sudarshana Dayananda
  • 5,165
  • 2
  • 23
  • 45
Takitaha
  • 103
  • 1
  • 2
  • 12

2 Answers2

3

Did you try to reinstall android platform in your project? If did not work try this: ionic android build - not enough memory to start jvm

  • I reinstalled android platform but it doesn't work. Im looking for this link. I hope this will be work. Thanks for answer – Takitaha Oct 10 '18 at 08:22
2

there are few things which could be help you

  • Remove platform and add it again
  • If you are using windows make sure you have install jdk with suitable env path
  • Go to android studio> sdk manger >install latest sdk tools
  • upgrade gradle
paras shah
  • 861
  • 2
  • 9
  • 23