Ionic - Android release build stuck on white screen after splash screen


#1

I posted a question about this a couple weeks ago but got no response. So Im posting again with a clearer issue/question.

My issue:

1.) I run:

    $ ionic cordova build android --release --prod

2.) Then I sign it.

3.) Then I upload to google play.

4.) Then I download it from google play and the app hits the splash screen, then gets stuck on a white screen after the splash screen closes on lower versions of android (So far anything under version 6.0.0).

To verify that it is my app that is the issue, I created a new app through the ionic cli using the “super” template. Then I built, signed, and uploaded it all the exact same way. I downloaded it from google play, and it worked. I made it into the app, including versions lower then 6.0.0.

So, my question is

  • How do I see what is causing the issue if it only happens in a release/production build?

  • Is there a way to debug?

  • Are there known functions (pipes, masks, modules, etc…) that angular/ionic uses that don’t work in older browsers found in older versions of android that could be causing this?

Project information:

@ionic/cli-plugin-cordova       : 1.6.1
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils                : 1.7.0
ionic (Ionic CLI)               : 3.7.0

global packages:

Cordova CLI : 7.0.1 

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

Node       : v6.11.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b 
ios-deploy : 1.9.1 
npm        : 3.10.10 

Config file:

<preference name="android-minSdkVersion" value="16" /> // This is the same as the default value generated by ionic-cli

// I use the hide() function in platform.ready() of my app.component to hide the splash screen. Did the same in the test generated app. Shouldnt be the issue.
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="500" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="30000" /> // Arbitrary time. platform.ready() should be called way before this. 
<preference name="loadUrlTimeoutValue" value="700000" /> // Added this because it was recommended for larger app sizes..?

My Plugins (I saw that someone else had a similar issue caused by a module import…?):

<plugin name="cordova-plugin-console" spec="^1.0.5" />
<plugin name="cordova-plugin-contacts" spec="^2.3.1" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-fingerprint-aio" spec="^1.2.1" />
<plugin name="cordova-plugin-geolocation" spec="^2.4.3">
    <variable name="GEOLOCATION_USAGE_DESCRIPTION" value=" " />
</plugin>
<plugin name="cordova-plugin-googlemaps" spec="^1.4.3">
    <variable name="API_KEY_FOR_ANDROID" value="AIzaSyBbYqJI-CZfV8_Zmj3laEGMbHsQenYo3V4" />
    <variable name="API_KEY_FOR_IOS" value="AIzaSyBbYqJI-CZfV8_Zmj3laEGMbHsQenYo3V4" />
    <variable name="NSLOCATIONWHENINUSEUSAGEDESCRIPTION" value="Show your location on the map" />
    <variable name="NSLOCATIONALWAYSUSAGEDESCRIPTION" value="Trace your location on the map" />
</plugin>
<plugin name="cordova-plugin-http" spec="^1.2.0" />
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-nativegeocoder" spec="^1.0.2" />
<plugin name="cordova-plugin-nativestorage" spec="^2.2.2" />
<plugin name="cordova-plugin-screen-orientation" spec="^1.4.3" />
<plugin name="cordova-plugin-secure-storage" spec="^2.6.8" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="cordova-sqlite-storage" spec="^2.0.4" />
<plugin name="ionic-plugin-deploy" spec="^0.6.7" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^3.2.2" />

#2

Not sure if this helps or not but one of the things I always do when running into issues with a native build from ionic is, I plug in my phone/tablet to my computer, run the app, then open up chrome on my computer and type in "chrome:://inspect"
then click on my device. That will show you the developer console for your app. Usually any errors will show themselves in the console and you can go from there.
If you already knew that, I apologize, I just thought it might help.


#3

Thanks. I have been doing that. But it does not let me inspect a release build, which is the only version of this that fails.


#4

The non-release and non-prod builds are all working fine?
The release-prod-build is fine if you install it locally instead of via Play Store?


#5

@ETSzettersten I am facing the same issue,
ionic cordova run android as well as emulate runs with no problems just when I build with --prod --release and then sign the app. The app then hangs at splash screen. I have no idea how to debug this.
I was wondering if you have found a solution or walk around to this.


#6

Find out if it is --prod or --release causing the problem. 99% sure it will be --prod. Then you can just debug the app with remove debugging and see what is going wrong.


#7

I’m pretty sure it’s the --prod --release. Because without this I can run on device, emulate and serve with no issues.


#8

Find out which of the both trigger the problem.


#9

This is how I fixed the issue
After running ionic cordova build android --prod --release --verbose I got this,
[DEBUG] Loading local plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_INVALID for local @ionic/cli-plugin-proxy
[ERROR] Error occurred while loading plugins. CLI functionality may be limited.
[DEBUG] Plugin error: PLUGIN_INVALID
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova

I removed the @ionic/cli-plugin-proxy from package.json
did rm -rf node_modules
npm install

And it builds --prod --release now and runs on device. Hope it helps someone


#10

I’m also facing this weird issue. I tried every solution mentioned here but nothing works for me :frowning:


#11

Any luck with this? I am facing a similar issue with iOS10. Works on iOS11 and Adnroid.