ionic-team / capacitor-assets

Local Capacitor icon/splash screen resource generation tool
MIT License
504 stars 99 forks source link

Splash screen is showing app icon instead of splash on Android 12+ #495

Open marekdon opened 1 year ago

marekdon commented 1 year ago

When running application on android < 11 devices, splash screen is showing correctly. On devices using android > 12 (new splash screen API), splash screen is replaced by icon.

christophermiles commented 1 year ago

I am seeing the same thing

rickbeumers commented 1 year ago

Maybe something to make it look nice for the time being.

If you create a styles-v31 (android 12+) file with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<resources>

  <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
    <item name="android:windowSplashScreenBackground">#3DDC84</item>
  </style>

</resources>

This will make the background of the splashscreen a specific color, if you match this with you app icon it looks quite alright for most (single color) app icons.

eeschiavo commented 1 year ago

Same issue here

mvaljento commented 1 year ago

So we can't use a splash screen graphic any more? It's just the icon with a colored background? That's very disappointing. Does anyone know if this is being worked on?

rickbeumers commented 1 year ago

So we can't use a splash screen graphic any more? It's just the icon with a colored background? That's very disappointing. Does anyone know if this is being worked on?

Android is moving more towards apps without splashscreens.

If you read their documentation on the new API they mention some of this stuff and also some design guidelines. https://developer.android.com/develop/ui/views/launch/splash-screen

For a capacitor application not showing a splash is just impossible since there is actual load time required. I don't like this approach either but for now there doesn't seem to be a workaround other then compiling for a lower SDK version. Anything above compileSdkVersion 30 will use the new splashscreen api. Setting this variable to 30 or lower should give you the old results but you might miss other benefits.

mvaljento commented 1 year ago

Thanks very much for the explanation, @rickbeumers!

co-dax commented 1 year ago

Guys, you can still use nine patches splash screens above api level 12.

jpike88 commented 1 year ago

Classic Google, pulling the rug on an API instead of letting it gracefully fall back.

I don't understand, can't this library just generate an XML drawable alongside the existing icons it makes?

From this link (https://github.com/apache/cordova-android/pull/1441#issue-1270501465)

The default splash screen is an XML Android Drawable. It has a resolution of 512x512. It is padded and the inner icon size is 384x384. It is also scalled by 50% and pivotX/Y of 256.
sboudouk commented 1 year ago

Hi.

I don't get it.

Does it mean that this repo is not up to date ? I started a fresh capacitor project and by using this, I get this issue.

Should I generate each assets separetly instead of relying on this ?

Thanks for the help.

andrmoel commented 1 year ago

tl;dr: It's not a bug. It's a feature. Google's new API does not allow full-screen splash screens anymore since Android 12+. You need to use an icon.

https://capacitorjs.com/docs/guides/splash-screens-and-icons

In Android 12 and above Google changed the way Splash Screens are displayed, using a smaller icon with colored background instead of a full screen image that was possible with Android 11 and below. Additional documentation about this change can be found at developer.android.com.

Googles Design Guide https://developer.android.com/develop/ui/views/launch/splash-screen

larsblumberg commented 4 months ago

Setting the splash screen background color for Android 12+

The comment https://github.com/ionic-team/capacitor-assets/issues/495#issuecomment-1445474546

Maybe something to make it look nice for the time being.

If you create a styles-v31 (android 12+) file with the following contents:

[...]

This will make the background of the splashscreen a specific color, if you match this with you app icon it looks quite alright for most (single color) app icons.

does the trick. Here's a full step by step guide to set the splash screen color for Android 12+:

In the res folder create a new resource directory values-v31

image

As the directory will not be immediately visible (as least that the case for me with the default settings for Android Studio), right click on the res/values directly and select New File from the context menu.

image

Click ok and type styles.xml for the file name.

Paste this:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
        <item name="android:windowSplashScreenBackground">#FF0000</item>
    </style>

</resources>

which should look like this:

image

and save the new file. Restart the app and you should now see a red background color. Adapt color to your needs.

matheo commented 1 month ago

I'm having a weird issue with my Splash Screen being opaque (like with some alpha while the App load) and I tried SplashScreen.show() after the App is initialized and the image is shown with the original vibrant colors. Anyone had this issue before? I'm going crazy :(