Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Ionic production build consumes all memory without successfully build .apk Memory LEAK #1429

Open
Stradivario opened this issue May 4, 2018 · 13 comments

Comments

@Stradivario
Copy link

Stradivario commented May 4, 2018

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

ionic cordova build android --aot --prod is consuming all memory available and it is not building application!

What behavior are you expecting?

Application should be build without much effort

Steps to reproduce:
1.nvm install 8.9.0/8.9.4/10.0.0
2.npm i -g ionic cordova
3.ionic cordova build android --aot --prod

screenshot from 2018-05-05 00-57-04

insert any relevant code between the above and below backticks
cli packages: (/home/rampage/.nvm/versions/node/v10.0.0/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : android 7.1.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v10.0.0
    npm  : 6.0.0
    OS   : Linux 4.15

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro
@Stradivario
Copy link
Author

Tested also with Node 8.9.0 and 8.9.4 it is the same as 10.0.0

@Stradivario Stradivario changed the title Ionic the new JAVA VM Memory LEAK Ionic production build consumes all memory without successfully build .apk Memory LEAK May 5, 2018
@leonavas
Copy link

leonavas commented May 7, 2018

+1 tested with node v6.11.5 and v9.11.1

@jessicastorm1986
Copy link

  • 1 , what is the solution i need to upload latest changes to android play store ? below are my info versions
cli packages: (C:\Users\jessica\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : android 7.0.0 browser 5.0.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v6.10.3
    npm               : 6.0.1
    OS                : Windows 8.1

@audacitus
Copy link

audacitus commented May 29, 2018 via email

@jessicastorm1986
Copy link

Well ionic cordova build android --aot worked, so according to you this is our solution for the moment ? and once we shift to ionic 4.0 we will have to find new ways..

@audacitus
Copy link

audacitus commented May 29, 2018 via email

@jessicastorm1986
Copy link

jessicastorm1986 commented May 30, 2018

alright, i have more than 60 + SCREENS and these kind of unexpected issues waste our time so much, wish ionic people understand this and provide us a simple smooth solution.

We use unity3d for game development, never got into any stupid errors while making a build ever..whenever i try to make a --prod or --aot build i get nervous, got phobia for this :(

@Stradivario
Copy link
Author

Stradivario commented Jun 13, 2018

@jessicastorm1986 remove the ^ inside package.json and install your dependencies.After that you will have package-lock.json everytime when you try to install use npm install --from-lock-file this way you will install everytime the same dependencies.Downside is that you will not get new updates but you will decide when to update, it costs time but i think it is the right way doing things.

About issue i face it long time ago and i decided to lock my working version and to be sure that my app will go into production without problems.Let me share my package.json with OLD (but gold) working version :)

{
  "name": "",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "build:prod:aot": "ionic build --prod --aot",
    "start:docker": "docker-compose up -d --force-recreate",
    "build:docker": "docker build -t juice/mobile/aot:latest ."
  },
  "dependencies": {
    "@angular/animations": "5.2.9",
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/compiler-cli": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@ionic-native/background-geolocation": "^4.7.0",
    "@ionic-native/core": "^4.7.0",
    "@ionic-native/facebook": "^4.7.0",
    "@ionic-native/geolocation": "^4.7.0",
    "@ionic-native/google-maps": "^4.7.0",
    "@ionic-native/location-accuracy": "^4.7.0",
    "@ionic-native/onesignal": "^4.7.0",
    "@ionic-native/secure-storage": "^4.7.0",
    "@ionic-native/splash-screen": "4.6.0",
    "@ionic-native/status-bar": "4.6.0",
    "@ionic/pro": "1.0.20",
    "@ionic/storage": "2.1.3",
    "@types/node": "^9.6.6",
    "angularfire2": "^5.0.0-rc.6.0",
    "cordova-android": "7.1.0",
    "cordova-browser": "5.0.3",
    "cordova-ios": "4.5.4",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-facebook4": "git+https://github.com/amritk/cordova-plugin-facebook4.git",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-googlemaps": "^2.2.9",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.2.0",
    "cordova-plugin-mauron85-background-geolocation": "^2.3.5",
    "cordova-plugin-request-location-accuracy": "^2.2.2",
    "cordova-plugin-secure-storage": "^2.6.8",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "^4.12.1",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "ngx-cache-layer": "^1.6.2",
    "onesignal-cordova-plugin": "^2.3.3",
    "rxjs": "5.5.8",
    "subscriptions-transport-ws": "^0.9.8",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.8",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-secure-storage": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-request-location-accuracy": {},
      "cordova-plugin-mauron85-background-geolocation": {
        "GOOGLE_PLAY_SERVICES_VERSION": "11+",
        "ANDROID_SUPPORT_LIBRARY_VERSION": "23+",
        "ICON": "@mipmap/icon",
        "SMALL_ICON": "@mipmap/icon",
        "ACCOUNT_NAME": "@string/app_name",
        "ACCOUNT_LABEL": "@string/app_name",
        "ACCOUNT_TYPE": "$PACKAGE_NAME.account",
        "CONTENT_AUTHORITY": "$PACKAGE_NAME",
        "ALWAYS_USAGE_DESCRIPTION": "This app always requires location tracking"
      },
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "cordova-plugin-facebook4": {
        "APP_ID": "",
        "APP_NAME": "",
        "ANDROID_SDK_VERSION": "4.+"
      },
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "",
        "API_KEY_FOR_IOS": "",
        "PLAY_SERVICES_VERSION": "12.0.0",
        "ANDROID_SUPPORT_V4_VERSION": "24.1.0"
      },
      "cordova-plugin-statusbar": {}
    },
    "platforms": [
      "android",
      "ios",
      "browser"
    ]
  }
}

Regards,
Kristiyan Tachev

@jayordway
Copy link

jayordway commented Jul 21, 2018

I updated the @angular-devkit/build-optimizer which @ionic/app-scripts leverages with version 0.0.35, for app-scripts version 3.1.8 and I updated @angular-devkit/build-optimizer to version 0.6.8. Now I can do a production build with ionic 3.9.2 and firebase 5.3.0

Note that something around or after @firebase/database 0.2.1 is the first version that causes the build to not finish.

@SpellChucker
Copy link

This is an issue for us too and is absolutely related to the --optimizejs flag. Without it, our builds take max 5 minutes. With it, our builds take 30+ minutes. It sucks, but we're going to have to move forward without the --optimizejs flag. We don't even use firebase (which seems to be a lot of people's problems). What does the --optimizejs flag even do??

@2mia
Copy link

2mia commented Aug 5, 2018

@jayordway, worked for me npm i @angular-devkit/[email protected]
made the build finish with ionic under 1.2GB

@Bengejd
Copy link

Bengejd commented Aug 5, 2018

@SpellChucker check out my solution on another thread, to being able to run ionic cordova build --device --prod --aot --minifyjs --minifycss --optimizejs --release. I hope it helps!

@leiamac
Copy link

leiamac commented Jan 2, 2019

@jayordway In my case just doing ´´´npm i @angular-devkit/build-optimizer --save-dev´´ solved the issue. I also have firebase installed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants