--prod stuck on white screen, no errors


When running the build with –release --prod, the android / browser / ios application is stuck on the white screen after the splash screen.

With only –release flag, it works fine on adroid / browser / ios. There is no error, nothing in the build log or in the console and in LogCat.

The following options work:

ionic cordova run android --release --max-old-space-size=4096 --verbose --aot
ionic cordova run android --release --max-old-space-size=4096 --verbose --minifyjs 
ionic cordova run android --release --max-old-space-size=4096 --verbose --optimizejs
ionic cordova run android --release --max-old-space-size=4096 --verbose --optimizejs --aot
ionic cordova run android --release --max-old-space-size=4096 --verbose --minifyjs --aot
ionic cordova run android --release --max-old-space-size=4096 --verbose --minifyjs --optimizejs

The following fails:

ionic cordova run android --release --max-old-space-size=4096 --verbose --minifyjs --optimizejs --aot

If I understood correctly, there are no console logs in prod and you cannot do remote debugging in the browser so I have no idea how to find out what went wrong.

When running a blank project it works.

I could start from scratch and incrementally add my code but since the build takes quite long it is impractical.

Any ideas?

Thank you in advance.

Build log:

$ ionic cordova run android --release --max-old-space-size=4096 --verbose --aot --minifyjs --optimizejs --stacktrace
[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: 'xxx', local: false, binPath: 'C:\\Users\\Lenovo\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\Lenovo\\AppData\\Roaming\\npm\\node_modules\\ionic\\dist\\index.js' }
[DEBUG] Daemon found (pid: 4760)
Running app-scripts build: --aot --minifyjs --optimizejs --platform android --target cordova
[13:22:38]  build dev started ...
[13:22:38]  clean started ...
[13:22:38]  clean finished in 23 ms
[13:22:38]  copy started ...
[13:22:38]  deeplinks started ...
[13:22:39]  deeplinks finished in 713 ms
[13:22:39]  ngc started ...
[13:23:16]  ngc finished in 36.68 s
[13:23:16]  preprocess started ...
[13:23:16]  preprocess finished in 1 ms
[13:23:16]  webpack started ...
[13:23:16]  copy finished in 38.35 s
[13:28:58]  webpack finished in 342.65 s
[13:28:58]  uglify started ...
[13:28:58]  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 warning.
[13:29:02]  sass finished in 4.06 s
[13:30:38]  uglify finished in 99.37 s
[13:30:38]  postprocess started ...
[13:30:38]  postprocess finished in 73 ms
[13:30:38]  lint started ...
[13:30:38]  build dev finished in 479.87 s
> cordova run android --release
Subproject Path: CordovaLib
Parallel execution is an incubating feature.

google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_d2nopw3voc2pmstl7pa0kkv4w.run(...\build.gradle:143)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest UP-TO-DATE
:preBuild UP-TO-DATE

Ionic info:

$ ionic info

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

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

global packages:

    cordova (Cordova CLI) : not installed

local packages:

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


    Android SDK Tools : 26.0.2
    Node              : v8.10.0
    npm               : 5.6.0
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : C:\dev\lib\Android\sdk


    backend : pro


   "dependencies": {
    "@angular/common": "5.0.3",
    "@angular/compiler": "5.0.3",
    "@angular/compiler-cli": "5.0.3",
    "@angular/core": "^5.2.8",
    "@angular/forms": "5.0.3",
    "@angular/http": "5.0.3",
    "@angular/platform-browser": "5.0.3",
    "@angular/platform-browser-dynamic": "5.0.3",
    "@ionic-native/action-sheet": "^4.5.3",
    "@ionic-native/barcode-scanner": "^4.5.3",
    "@ionic-native/camera": "^4.5.3",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/fcm": "^4.5.3",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "4.4.0",
    "@ionic/pro": "1.0.20",
    "@ionic/storage": "2.1.3",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "angularfire2": "^5.0.0-rc.6",
    "cordova-android": "^6.4.0",
    "cordova-browser": "latest",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-camera": "^4.0.2",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.1",
    "cordova-plugin-fcm": "^2.1.2",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "^4.11.0",
    "ionic-angular": "3.9.2",
    "ionic-img-viewer": "^2.9.0",
    "ionicons": "3.0.0",
    "moment": "^2.20.1",
    "ngx-qrcode2": "0.0.5",
    "ngx-quill": "^2.1.2",
    "phonegap-plugin-barcodescanner": "^7.0.2",
    "rxjs": "^5.5.4",
    "striptags": "^3.1.1",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  "devDependencies": {
    "@ionic/app-scripts": "3.1.8",
    "check-dependencies": "^1.1.0",
    "typescript": "2.4.2"


Did you solve your problem? is it a plugin that is triggering the error?


No. It turns out it was a problem with Firebase imports. It was almost impossible to find and required a binary search of hours of removing files and rebuilding the project. At a certain time there was finally an error in the logs during runtime that said: Uncaught TypeError: Cannot read property ‘FieldValue’ of undefined.

I removed all direct imports of types:

import QuerySnapshot = firebase.firestore.QuerySnapshot;
import FieldValue = firebase.firestore.FieldValue;

And explicitly referred to these type in the code.


Getting this strange behavior again! This time only on iOS10. Works fine on iOS 11.
No errors in the logs.

It is impossible to build applications this way when having to deal 90% of the time with delicate framework issues!

Any help/suggestions will be highly appreciated.