apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.67k stars 1.54k forks source link

Splash screen icon not show at first launch #1701

Open campagna91 opened 7 months ago

campagna91 commented 7 months ago

Bug Report

Problem

What is expected to happen?

Icon should be visible at each start up.

What does actually happen?

The splash screens show only the background color specified in the config.xml but not the drawable vector icon. This scenario occurs only the FIRST time (after the installation). Once the app is being opened once, after having close it, the icon is showed at each opening.

Information

Here below my config.xml

`<?xml version='1.0' encoding='utf-8'?> <widget android-activityName="APP_NAME" id="com.company.APP_NAME" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:gap="http://phonegap.com/ns/1.0">

<!-- General Info -->

<name>APP_NAME</name>
<description>An app for booking from COMPANY S.r.l.</description>
<author email="sviluppo@company.com" href="https://www.company.com/">Contact us</author>
<content src="index.html" />

<!-- Platforms Target -->

<engine name="android" spec="12.0.1"/>
<engine name="ios" spec="7.0.1" />

<!-- Permissions -->

<access origin="*"/>
<allow-intent href="sms:*" />
<allow-intent href="tel:*" />
<allow-intent href="geo:*" />
<allow-intent href="mailto:*" />
<allow-intent href="file://*/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />

<!-- SCHEME and DOMAIN  -->

<preference name="scheme" value="ionic" />
<preference name="hostname" value="localhost" />
<preference name="Scheme" value="ionic" />
<preference name="iosScheme" value="ionic" />
<preference name="Hostname" value="localhost" />
<preference name="WKPort" value="" />

<!-- Preferences -->

<preference name="webviewbounce" value="false" />
<preference name="KeyboardResize" value="false" />
<preference name="BackupWebStorage" value="none" />
<preference name="DisallowOverscroll" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="false"/>

<!-- Splash screen -->
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="FadeSplashScreenDuration" value="400" />
<preference name="SplashScreenDelay" value="3000" />

<!-- Hooks -->

<hook src="www/hooks/fwk-after-prepare-hooks.js" type="after_prepare" />
<hook src="www/hooks/fwk-after-plugin-add-hooks.js" type="after_plugin_add" />
<hook src="www/hooks/fwk-after-prepare-copy-build-extra-hooks.js" type="after_prepare" />
<hook src="www/hooks/fwk-after-compile-hooks.js" type="after_compile" />
<hook src="www/hooks/fwk-before-build-hooks.js" type="before_build" />

<!-- Android -->

<platform name="android">

    <preference name="AndroidXEnabled" value="true" />

    <!-- SDK version -->
    <preference name="android-minSdkVersion" value="22" />
    <preference name="android-maxSdkVersion" value="34" />
    <preference name="android-targetSdkVersion" value="34" />

    <!-- Splashscreens -->
    <preference name="AndroidWindowSplashScreenAnimatedIcon" value="www/res/icon/app/icon.xml" />
    <resource-file src="www/res/assets/colors.xml" target="/app/src/main/res/values/colors.xml" />
    <icon background="@color/background" density="ldpi" foreground="www/res/icon/app/icon.xml" src="www/res/icon/app/icon-ldpi.png" />
    <icon background="@color/background" density="mdpi" foreground="www/res/icon/app/icon.xml" src="www/res/icon/app/icon-mdpi.png" />
    <icon background="@color/background" density="hdpi" foreground="www/res/icon/app/icon.xml" src="www/res/icon/app/icon-hdpi.png" />
    <icon background="@color/background" density="xhdpi" foreground="www/res/icon/app/icon.xml" src="www/res/icon/app/icon-xhdpi.png" />
    <icon background="@color/background" density="xxhdpi" foreground="www/res/icon/app/icon.xml" src="www/res/icon/app/icon-xxhdpi.png" />
    <icon background="@color/background" density="xxxhdpi" foreground="www/res/icon/app/icon.xml" src="www/res/icon/app/icon-xxxhdpi.png" />

    <!-- Push Configurations -->
    <!-- Don't remove the below line! -->
    <!-- Don't modify this resources-file list because it's generate-->
    <resource-file src="www/res/configurations/push/google-services.json" target="/app/src/debug/google-services.json" />
    <resource-file src="www/res/configurations/push/google-services.json" target="/app/src/release/google-services.json" />

    <!-- Push Icons -->
    <resource-file src="www/res/icon/push/mipmap-mdpi/ic_notification.png" target="app/src/main/res/mipmap-mdpi/ic_notification.png" />
    <resource-file src="www/res/icon/push/mipmap-hdpi/ic_notification.png" target="app/src/main/res/mipmap-hdpi/ic_notification.png" />
    <resource-file src="www/res/icon/push/mipmap-xhdpi/ic_notification.png" target="app/src/main/res/mipmap-xhdpi/ic_notification.png" />
    <resource-file src="www/res/icon/push/mipmap-xxhdpi/ic_notification.png" target="app/src/main/res/mipmap-xxhdpi/ic_notification.png" />
    <resource-file src="www/res/icon/push/mipmap-xxxhdpi/ic_notification.png" target="app/src/main/res/mipmap-xxxhdpi/ic_notification.png" />

    <!-- Allow Extenal Storage capacity -->
    <!-- Allow older android to choose photos from Gallery -->
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:requestLegacyExternalStorage="true"/>
    </edit-config>

    <config-file target="AndroidManifest.xml" parent="/manifest">
        <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    </config-file>

</platform>

<!-- iOS -->

<platform name="ios">
    <!-- CORS -->

    <!-- From cordova-ios 6.x doc. -->
    <preference name="scheme" value="ionic" />
    <preference name="hostname" value="localhost" />

    <!-- From cordova-plugin-ionic-migrate-storage github -->
    <preference name="Scheme" value="ionic" />
    <preference name="iosScheme" value="ionic" />
    <preference name="Hostname" value="localhost" />
    <preference name="WKPort" value="" />

    <!-- Storage Porting -->
    <!-- From 'file__0.localstorage' format to 'app_localhost_0.localstorage' -->
    <preference name="MIGRATE_STORAGE_ORIGINAL_SCHEME" value="file" />
    <preference name="MIGRATE_STORAGE_ORIGINAL_HOSTNAME" value="" />
    <preference name="MIGRATE_STORAGE_ORIGINAL_PORT_NUMBER" value="0" />

    <!-- Push Firebase -->
    <resource-file src="www/res/configurations/push/GoogleService-Info.plist" />

    <!-- Resouces -->
    <icon height="20" src="www/res/icon/app/Icon-20.png" width="20" />
    <icon height="48" src="www/res/icon/app/AppIcon24x24@2x.png" width="48" />
    <icon height="55" src="www/res/icon/app/AppIcon27.5x27.5@2x.png" width="55" />
    <icon height="88" src="www/res/icon/app/AppIcon44x44@2x.png" width="88" />
    <icon height="172" src="www/res/icon/app/AppIcon86x86@2x.png" width="172" />
    <icon height="196" src="www/res/icon/app/AppIcon98x98@2x.png" width="196" />
    <icon height="29" src="www/res/icon/app/Icon-Small.png" width="29" />
    <icon height="40" src="www/res/icon/app/Icon-Small-40.png" width="40" />
    <icon height="40" src="www/res/icon/app/AppIcon24x24@2x.png" width="40" />
    <icon height="40" src="www/res/icon/app/Icon-20@2x.png" width="40" />
    <icon height="50" src="www/res/icon/app/Icon-50.png" width="50" />
    <icon height="57" src="www/res/icon/app/Icon.png" width="57" />
    <icon height="58" src="www/res/icon/app/AppIcon29x29@2x.png" width="58" />
    <icon height="60" src="www/res/icon/app/Icon-20@3x.png" width="60" />
    <icon height="58" src="www/res/icon/app/Icon-Small@2x.png" width="58" />
    <icon height="72" src="www/res/icon/app/Icon-72.png" width="72" />
    <icon height="76" src="www/res/icon/app/Icon-76.png" width="76" />
    <icon height="80" src="www/res/icon/app/Icon-Small-40@2x.png" width="80" />
    <icon height="80" src="www/res/icon/app/AppIcon40x40@2x.png" width="80" />
    <icon height="80" src="www/res/icon/app/Icon-Small-40@2x.png" width="80" />
    <icon height="87" src="www/res/icon/app/Icon-Small@3x.png" width="87" />
    <icon height="87" src="www/res/icon/app/AppIcon29x29@3x.png" width="87" />
    <icon height="100" src="www/res/icon/app/Icon-50@2x.png" width="100" />
    <icon height="114" src="www/res/icon/app/Icon@2x.png" width="114" />
    <icon height="120" src="www/res/icon/app/Icon-60@2x.png" width="120" />
    <icon height="120" src="www/res/icon/app/Icon-Small-40@3x.png" width="120" />
    <icon height="144" src="www/res/icon/app/Icon-72@2x.png" width="144" />
    <icon height="152" src="www/res/icon/app/Icon-76@2x.png" width="152" />
    <icon height="167" src="www/res/icon/app/Icon-83.5@2x.png" width="167" />
    <icon height="180" src="www/res/icon/app/Icon-60@3x.png" width="180" />
    <icon height="1024" src="www/res/icon/app/icon-1024.png" width="1024" />

    <splash src="www/res/splashscreen/Default@2x~universal~anyany.png"/>

</platform>

<!-- PLUGINS LIST -->
<!-- DONT ERASE LINE BELOW -->
<!-- Don't modify this plugins list because it's generate-->
<plugin name="cordova-plugin-app-version" spec="0.1.9"/>
<plugin name="cordova-plugin-calendar" spec="5.1.6"/>
<plugin name="cordova-plugin-call-number" spec="1.0.1"/>
<plugin name="cordova-plugin-device" spec="1.1.7"/>
<plugin name="cordova-plugin-file" spec="6.0.2"/>
<plugin name="cordova-plugin-inappbrowser" spec="4.0.0"/>
<plugin name="cordova-plugin-ionic-keyboard" spec="2.2.0"/>
<plugin name="cordova-plugin-media-capture" spec="3.0.3">
    <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Allow_the_app_to_access_your_photos" />
</plugin>
<plugin name="cordova-plugin-network-information" spec="1.3.4"/>
<plugin name="cordova-plugin-statusbar" spec="2.4.3"/>
<plugin name="cordova.plugins.diagnostic" spec="6.1.0"/>
<plugin name="cordova-plugin-fbsdk" spec="4.0.2">
    <variable name="APP_ID" value="XXXXXXXXXXXXXXX" />
    <variable name="APP_NAME" value="com.company.APP_NAME" />
    <variable name="CLIENT_TOKEN" value="XXXXXXXXXXXXXXX" />
</plugin>
<plugin name="@havesource/cordova-plugin-push" spec="4.0.0"/>
<plugin name="cordova-plugin-camera" spec="6.0.0">
    <variable name="CAMERA_USAGE_DESCRIPTION" value="Allow_the_app_to_use_your_camera" />
    <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Allow_the_app_to_access_your_photos" />
</plugin>

`

Command or Code

If can help, deploying directly from the Android studio (using version Iguana | 2023.2.1 Patch) the icon splash screen works like a sharm - so no issue. The problem appear only after having build the app and publish to our OTA (with same code obviously).

Environment, Platform, Device

i'm using for test purpose:

Version information

Checklist

breautek commented 7 months ago

I would suggest raising the issue on google's issue tracker if you're encountering on Android 13 or later. Maybe it's a regression. Be prepared to provide a sample application.

This was a known issue for Android 12 or any earlier version which used the compatibility library and was supposedly fixed in Android 13 based on a google issue ticket which I can no longer find.

The splashscreen is entirely powered by Android SDK now, so I don't think there is anything that Cordova can do.

egonzalez-handtevy commented 3 months ago

@campagna91 did you find a solution or workaround for this? 🙏

gmoneyman commented 1 month ago

I have same issue in Android 13. Anything from anyone?