Cordova - white screen after splash, no exceptions in console
Well that was ugly. It turned out that there was an exception being thrown, it was just being thrown too early for the browser dev tools to pick it up (Safari, Chrome for iOS and Android, respectively). The exception did show up when I ran things through the browser target (cordova platform add browser
, etc.) So that browser platform is useful for something I guess. :-)
In my case, the cordova-sqlite-storage plugin had made a breaking API change that broke the code when I updated everything. The solution was to pin the plugin to an earlier version in the config.xml file.
So, lessons learned:
- If you suspect there's an exception being thrown during startup, you can use the browser platform to track it down.
- Pin your plugins to a specific version using the
spec
parameter in the config.xml. This will save you some heartache in the future. - [another option from @jcesarmobile, below] hitting refresh in the browser dev tools will also kick out the exception. Nice!
I'll be going back in to the config.xml and pinning the other items -- and doing some cleanup as suggested above. Thanks again, everyone.
I manged to run your app this are the steps I followed.
1) First you need to declare Splash screen preference along with splash screen plugin location in your config.xml. This is what I think you are missing
<preference
name="SplashScreen"
value="screen" />
<preference
name="AutoHideSplashScreen"
value="true" />
<preference
name="SplashScreenDelay"
value="5000" />
<feature name="SplashScreen" >
<param
name="android-package"
value="org.apache.cordova.splashscreen.SplashScreen" />
<param
name="onload"
value="true" />
</feature>
2) Declare your splash screens images in config.xml ,which you have already done.
I suggest you to keep images in default density folders of android project (ldpi,mdpi,hdpi,xhdpi etc) instead of screen/android folder as it will simplifiy your project structure.
<!-- you can use any density that exists in the Android project -->
<splash
density="land-hdpi"
src="res/drawable-land-hdpi/splash.png" />
<splash
density="land-ldpi"
src="res/drawable-land-ldpi/splash.png" />
<splash
density="land-mdpi"
src="res/drawable-land-mdpi/splash.png" />
<splash
density="land-xhdpi"
src="res/drawable-land-xhdpi/splash.png" />
<splash
density="port-hdpi"
src="res/drawable-hdpi/splash.png" />
<splash
density="port-ldpi"
src="res/drawable-ldpi/splash.png" />
<splash
density="port-mdpi"
src="res/drawable-mdpi/splash.png" />
<splash
density="port-xhdpi"
src="res/drawable-xhdpi/splash.png" />
</platform>
3) Add Splash screen plugin class into your android project structure under org.apache.cordova.splashscreen package or install splash screen Cordova plugin
https://cordova.apache.org/docs/en/3.1.0/cordova/splashscreen/splashscreen.html
4) Final and most important step you must have cordova.js in your www folder
And after that I was able to run your web app
I am android developer I guess something similar you might need to do for iOS