RC4 - White screen on startup (Android)
Ionic version: (check one with "x") [ ] 1.x [x] 2.x
I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior: Ionic 2 Android application hangs with a white screen during startup. It takes 10 - 12 secs for the app to display root page after splash-page / spinner fades. This doesn't occur in browser with ionic serve.
Expected behavior: RC3 is booting fine without any white screens following splash-page.
Steps to reproduce: Thinking that I had an issue with my code, tested with a blank app - could produce the same issue.
$ ionic start cutePuppyPics --v2 $ cordova platform add android $ ionic run android
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v7.2.1
Xcode version: Not installed
package.json
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/storage": "1.1.6",
"ionic-angular": "2.0.0-rc.4",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.47",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-device",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "cutePuppyPics: An Ionic project"
}
Have you tried to build the Release app? Ionic build Android --release --prod and measure the time here? The RC4 changed much while building #6776 see here
Much better ,thanks. But building for release also adds an extra step to sign the application as (AFAIK) you can't install an unsigned apk to a device. "ionic run android" was much more convenient in that sense. Anyway, if this is not a bug on ionic side, I'll try to automate release build (apk sign -> device install) with a bash script.
You can use ionic run android --prod, then no signing is required, but AoT and minification are used.
Try bumping ionic storage to 1.1.7
https://github.com/driftyco/ionic/issues/9677
I tried with both approaches but there is no improvement, it still takes 10 seconds to load the root page, not sure... And is it required to use ionic build or ionic run? I usually build my app through platform specific IDE (i.e. xCode and Android Studio), so I only use ionic prepare <platform> (cordova prepare <platform>) and build/publish the app through the platform specific IDE.
Same issue here. Any suggestion please? This is happening only with the RC4. @asa47?
@pwespi 's suggestion ionic run android --prod worked for me.
@alexbainbridge I tried that, it didn't solve my case. In my case "serve" works fine but "build" produces the white-screen delay on startup.
@demirk4n ionic-app-scripts 0.47 requires you to make a main.ts and remove your main.dev.ts and main.prod.ts... Did you follow those instructions in the CHANGELOG.md?
@MT-- Yes, of course. With out that it wouldn't even build.
@demirk4n kk, just checking! 😞
@MT-- Hey, no problem. Thanks for asking my fellow ionican :)
I have the same issue. Will try with --release apk. And will report back.
Hey guys, please make sure that this is working on your side:
Comment from dan: https://github.com/driftyco/ionic/issues/6776#issuecomment-267378745
If you can't run npm run ionic:build --aot then something is wrong.
Even if you see RC4 and Appscripts 0.47 - I had the same problems that I couldn't run this command - so maybe try it then with a complete new setup.
Greetings
Hello Guys, I set the following preferences in the config.xml and now I have not the white screen at the beginning for some seconds. But it seems to me that somehow it takes more time for the App the be ready in Android with the RC4. So probably the question is not about the white screen but about the loading/ready() time in Android. The same applies also to the official starting apps. More close to this report https://forum.ionicframework.com/t/rc4-seems-slower-to-load-the-app/73495
<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="FadeSplashScreenDuration" value="300"/>
<preference name="SplashScreenDelay" value="2000"/>
<preference name="FadeSplashScreenDuration" value="1000"/>
<preference name="SplashScreen" value="screen"/>
<preference name="ShowSplashScreenSpinner" value="true"/>
<preference name="AutoHideSplashScreen" value="false"/>
Best George
Hi, i have the same issue, i installed the splashscreen plugin and used ionic resources to generate all images but when i run on device i have a white screen some seconds and then the app appears.
There is a issue with this on ionic-cli: https://github.com/driftyco/ionic-cli/issues/1776
<platform name="android">
<allow-intent href="market:*"/>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="21"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreenDelay" value="0"/>
<preference name="FadeSplashScreen" value="false"/>
<preference name="FadeSplashScreenDuration" value="0"/>
<preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF"/>
<preference name="SplashScreen" value="screen"/>
This is my config.xml and this my ionic info:
Your system information:
Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI Version: 2.1.17 Ionic App Lib Version: 2.1.7 Ionic App Scripts Version: 0.0.47 ios-deploy version: Not installed ios-sim version: Not installed OS: Linux 3.13 Node Version: v6.9.1 Xcode version: Not installed
Same. If I specify a value > 0 for "SplashScreenDelay" the splash screen shows up for the specified amount of time. However, I would prefer the same behavior as with iOS, where a value of 0 shows the splash screen until the app is started.
same situation :(
Can everyone make sure they are running the latest CLI 2.1.17:
npm install -g ionic@latest
ionic -v
and then make sure you are on the latest @ionic/app-scripts: https://github.com/driftyco/ionic-app-scripts/blob/master/CHANGELOG.md#0047-2016-12-12
Then, compare your config.xml with the conference app, for example: https://github.com/driftyco/ionic-conference-app/blob/master/config.xml
You should remove the android platform and add it back:
ionic platform rm android
ionic platform add android
and then make sure you are using the --prod flag:
ionic run android --prod
Please let me know if you are still having issues after this, and include a sample repository if you can.
As for the longer load times, we are currently working on reducing the bundle size in order to speed up load times. cc @danbucholtz
@danbucholtz Thanks. Works for me, if I specify a value SplashScreenDelay. Since 3000ms is to short, I guess I will have to set a very large value and close the splash screen in the app.component.
But why are iOS and Android different? iOS works also with SplashScreenDelay=0
If i run the build with --prod i get the following output:
> ionic-app-scripts build "--prod"
[22:47:14] ionic-app-scripts 0.0.47
[22:47:14] build prod started ...
[22:47:14] clean started ...
[22:47:14] clean finished in 6 ms
[22:47:14] copy started ...
[22:47:14] ngc started ...
[22:47:28] ngc finished in 14.44 s
[22:47:28] webpack started ...
[22:47:28] copy finished in 14.66 s
(node:20671) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token u in JSON at position 0
If i run it without --prod i get a white screen for about 5 seconds. With RC3 the loading time is a lot faster than RC4.