1

I am trying to add a splashscreen to my ionic app. Here are the steps i followed:

$ionic start splashtest blank
$ionic platform add android
$cordova plugin add cordova-plugin-splashscreen

Now, Updated my icon.png and splash.png to  /splashtest/resources/ folder 
where the default icon.png and splash.png was there.

$ionic resources --splash
$ionic resources --icon

Generated Successfully.

The config.xml in my project folder( c:/splashtest/) is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.splashv2209052" version="0.0.1"   xmlns="http://www.w3.org/ns/widgets"  xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>splashv2</name>
<description>
    An Ionic Framework and Cordova project.
</description>
<author email="you@example.com" href="http://example.com/">
  Your Name Here
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="SplashScreenDelay" value="2000"/>
<preference name="FadeSplashScreenDuration" value="2000"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreen" value="screen"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
<platform name="android">
<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-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
<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"/>
<splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
 <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"/>
</platform>
<icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
</widget>

I also saw that the icons in /splashtest/platforms/android/res/ are the default ones. But, my config.xml refers to the resources/android/splash folder. How can i fix this

Ionic -v
2.1.8


cordova -v
6.4.0

Thanks

Sourav Das
  • 982
  • 1
  • 15
  • 40

3 Answers3

2

You have the latest version of cordova, but probably not the latest version of the android platform. Update to the latest version.

cordova platform update android@6.1.0

EDITED: added @6.1.0 to the above command. Otherwise it will install version 6.0.0 and you will still have these problems.

EDITED: Recently released Cordova version 6.5.0 has cordova-android version 6.1.1. So, now you can do:

npm install -g cordova
JanP
  • 1,579
  • 2
  • 16
  • 27
1

Faced the same issue. Upgrading to android 6.1.1 solved the problem. Worked for me in :

cordova 6.5 (cordova --version)
cordova platform update android@6.1.1

Unfortunatly, it created a conflict with admodpro that I solved in this way :
In my config.xml :

<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<preference name="android-build-tool" value="gradle"/>
<plugin name="cordova-plugin-admobpro" source="npm"/>

Be careful, don't write "gap:plugin" but only "plugin". That changed everything for me.

sylv
  • 11
  • 1
0

I know it's weird, but try to downgrade to Cordova 6.3.1, recently I have the same issue and must to downgrade to make it work (You may also need to re add the platform)

I'm still looking what changes in the CLI could cause this. (or what new way we must implement to make it work)

jjdltc
  • 136
  • 1
  • 8