FGF-College-Work / Forum

:beer: Espaço dedicado a discussões e tira dúvida sobre disciplinas e conteúdo tecnológico.
MIT License
13 stars 4 forks source link

Gradle error to download when execute ionic build android #53

Open marcialwushu opened 6 years ago

marcialwushu commented 6 years ago

I am try to compile an new project using command ionic build android, but i get this error:

C:\Users\pedromiguel\aplicacionesIonic\sqliteTest>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\pedromiguel\aplicacionesIonic\sqliteTest\hooks\after_prepare\010_add_platform_class.js C:\Users\pedromiguel\aplicacionesIonic\sqliteTest

add to body class: platform-android

ANDROID_HOME=C:\Users\pedromiguel\AppData\Local\Android\sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_101

Subproject Path: CordovaLib

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 http://gradle.org/docs/2.2.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.

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 http://gradle.org/docs/2.2.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.
marcialwushu commented 6 years ago
cli packages: (C:\Users\marcospaulo\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 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v9.5.0
    npm               : 5.6.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\marcospaulo\AppData\Local\Android\Sdk\

Misc:

    backend : pro
marcialwushu commented 6 years ago

fix is here (FOR WINDOWS ONLY)

I am facing the same problem of Build then i finally found out the solution.

SOLUTION

So You must have the Android Api 23 in order for this command to work.

Error of Daemon process will be solve after installing the Api 23 and extra build tools and run command

COMMAND : cordova build android --release

I am sure this fix would help you to solve the problem.

STEPS

First check the version of android through this COMMAND: cordova platform help Run the build command after installing the Api 23 and extra build tools. If Even this not work then Try add the variable in the

Environment variables > System variables >

add _JAVA_OPTIONS and value = -Xmx512M Then Run cordova build android --release

BUT FIRSTLY SET UP THE ENVIRONMENT VARIABLES

Environment Variable setup Image

android API 23

COPY FROM HERE

ENVIRONMENT VARIABLES:-

USER VARIABLES

PATH

C:\Ruby23\bin;C:\Users\kumar\AppData\Roaming\npm;C:\ANDROID_SDK\tools;%SystemRo ot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;

SYSTEM VARIABLES

ADD NAME AND VALUE

2.1 _JAVA_OPTIONS -Xmx512M

2.2 ANDROID_HOME C:\ANDROID_SDK

2.3 PATH ->

C:\ProgramFiles\Java\jdk1.8.0_60\bin;C:\ProgramFiles\nodejs;C:\Gradle\gradle-4.0\bin;C:\ANDROID_SDK\tools;%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;

marcialwushu commented 6 years ago

https://github.com/ionic-team/ionic-cli/issues/1800