1
votes

My app keeps using the default cordova icon and splash screen. Upon digging, what should happen is all of my icon/splash get copies to platforms/android/res/. When I look in there, it's just the default cordova ones. However, in my resources/android/ all of my custom ones are there.

Working fine for iOS, not fine for Android at. I am running Cordova CLI 6.4.0. I have all the custom icons and splash images setup in correct directory structure, and receive no errors during platform add or build android

Below is my config.xml

<platform name="android">
    <allow-intent href="market:*" />
    <icon platform="android" src="resources/icon.png" />
    <icon platform="android" qualifier="ldpi" src="resources/icons/android/icon-36-ldpi.png" />
    <icon platform="android" qualifier="mdpi" src="resources/icons/android/icon-48-mdpi.png" />
    <icon platform="android" qualifier="hdpi" src="resources/icons/android/icon-72-hdpi.png" />
    <icon platform="android" qualifier="xhdpi" src="resources/icons/android/icon-96-xhdpi.png" />
    <icon platform="android" qualifier="xxhdpi" src="resources/icons/android/icon-144-xxhdpi.png" />
    <icon platform="android" qualifier="xxxhdpi" src="resources/icons/android/icon-192-xxxhdpi.png" />
    <splash platform="android" src="resources/splash.png" />
    <splash platform="android" qualifier="ldpi" src="resources/screens/android/screen-ldpi-portrait.png" />
    <splash platform="android" qualifier="mdpi" src="resources/screens/android/screen-mdpi-portrait.png" />
    <splash platform="android" qualifier="hdpi" src="resources/screens/android/screen-hdpi-portrait.png" />
    <splash platform="android" qualifier="xhdpi" src="resources/screens/android/screen-xhdpi-portrait.png" />
</platform>

<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="2000" />
<preference name="FadeSplashScreen" value="false" />
<preference name="FadeSplashScreenDuration" value="0" />
<preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF" />
  1. Same exact exact setup for iOS, and works perfectly there
  2. I've triple checked the paths and everything is correct, and my custom icons are indeed in the indicated locations, but simply not copied over during build
  3. I've tried several times to remove and add android platform, then build, same with cordova-plugin-splashscreen
  4. Both the icon and the splash screen are not working on Android

And here's a screencap showing the folder layout, and the unfortunately incorrect images. platforms/android resources/icons/android

Update made some progress but not quite there. I replaced "qualifier" with "density" in my config.xml. Now what it does it create a correct looking "res" folder, but it puts it in the root of my project instead of platforms/android. It also creates platforms/android/res but all of the images in there are the default Cordova ones. If I move the new folder /res (my custom icons) into /platforms/android (default cordova icons) before build then the app shows my correct stuff. I guess it's a working workaround but an annoying one... and to note; I delete the /res folder but cordova platform add android builds it, just seems to create it in the wrong directory.

3

3 Answers

6
votes

This is an issue in cordova-android solved in the version 6.1.0.

The recommended steps are:

cordova platform update [email protected] --save
cordova platform rm android
cordova platform add android

Source: https://github.com/apache/cordova-android/pull/343

3
votes

I have the same problem, If you find a solution tell me please :)

EDIT

I Solved updgrading my version of android

cordova platform update [email protected]

1
votes

I had this problem some time before and I, and found two ways to pass over.

  • Upgrade Cordova Platform: This is the recomended, I believe that you upgrade to Cordova 6.4.x but not your Platform, please try: cordova platform update android@latest

OR

  • Downgrade Cordova CLI: Sometimes, the prev step does not work, so you have to do something that is disrecomended, downgrade cordova to work npm install -g [email protected] (Note => CLI 6.3.1 is just the version I believe could work)