Only white screen is visible when using --prod with android build

When I am building using

Ionic cordova build android

App is working fine but when I am using --prod flag only white screen is visible. Kindly help if anybody know about this.

Thanks

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: https://ionic.zone/debug/remote-debug-your-app#android Look at the console and network tabs for errors.

Also:
Where are you testing?
What is you ionic info output?

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts              : 1.3.12
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.0

System:

Node : v6.11.0
OS   : Windows 10
npm  : 4.4.4

I am testing on samsung device and I am not getting any error! its just white screen!! when using --prod flag

Hy there, I came with the same issue last week also, I managed to solve it. AoT seems to be the one causing so much trouble. Some things that you have to keep in mind when using --prod are:

  1. You can’t use custom annotations, AoT will ignore them as far as I understand. For example, if you are using angular-redux you can’t user @select, use store.select() instead.

  2. I moved from Ionic 3.0 to 3.6.

  3. First find the problem by run the app on the browser, check the console:
    ionic cordova run browser --prod --relese.

  4. I had to change some imports as Aot somehow wasn’t getting them right. NgReduxFormModule for example, changed from:

import { NgReduxFormModule } from “@angular-redux/form”;

to:

import { NgReduxFormModule } from “@angular-redux/form/dist/source”;

It took like 2 days o get it working but it’s worth it. For example, the download time from the server for the browser version is now only 3 seconds instead of 5 ±-. I hope this helps you or anybody in the same situation. Cheers.

3 Likes

Thanks man,

You saved me…

Hi,

I’m having the same issue. Using “–prod” only shows a white screen. I don’t have this problem on Android 7, but I do with Android 4.4.4. I don’t have any issue in the chrome console when running on android device. I don’t have any issue in the console when running on browser. I don’t have this problem on iOS.

Did someone solve this issue ?

ionic info :

cli packages: (/usr/local/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 2.1.0
    Cordova Platforms  : android 6.3.0 browser 5.0.3 ios 4.5.4
    Ionic Framework    : ionic-angular 3.6.1-201709221952

System:

    ios-deploy : 1.9.2 
    ios-sim    : 6.1.2 
    Node       : v6.9.4
    npm        : 3.10.10 
    OS         : macOS Sierra
    Xcode      : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Edit : Solved it by installing the crosswalk plugin :

cordova plugin add cordova-plugin-crosswalk-webview