jonbhanson / flutter_native_splash

Automatically generates native code for adding splash screens in Android and iOS. Customize with specific platform, background color and splash image.
https://pub.dev/packages/flutter_native_splash
MIT License
1.36k stars 215 forks source link

Android 12+ issues (fullscreen and icon_background_color) #626

Open jibbers42 opened 1 year ago

jibbers42 commented 1 year ago

Attention: If you open a bug report without sufficient details, it will be closed. Is your question related to Android 12? Please check the notes on Android 12 first (https://pub.dev/packages/flutter_native_splash#android-12-support).

Describe the bug

Configuration

flutter_native_splash:
  color: "#42a5f5"
  image: "assets/splash.png"

  android_12:
    color: "#42a5f5"
    icon_background_color: "#111111"

  ios: false
  web: false
  android_gravity: fill
  fullscreen: true

Device (please complete the following information):

To Reproduce Steps to reproduce the behavior, using the example app:

  1. Set the config on the example app to config given above.
  2. Run using devices listed above.
  3. See fullscreen have no effect on Android 12+
  4. See icon background color remain white on Android 12+.

Additional context The readme links to https://developer.android.com/about/versions/12/features/splash-screen, I'm not sure if I'm supposed to make a changes listed there, but I did add implementation "androidx.core:core-splashscreen:1.0.0" to my build.gradle as a test, but it had no effect.

labrujasiete commented 12 months ago

I wanted to reach out regarding an issue I'm experiencing with the native_splashscreen on Android 12. I've tested it on versions 11, 12, and 13, and here's what I found:

I've tried various approaches, but on Android 12, there seems to be no way to make the image display. Have you encountered a similar problem, or do you have any insights on resolving this?

this is my configuration:

flutter_native_splash:
  color: "#8F497B"
  image: assets/images/winesip_splashscreen.png
  fullscreen: true
  ios_content_mode: scaleToFill
  android_gravity: fill
  web: false

  android_12:
    color: "#8F497B"
    image: assets/icons/launcher/android/splashScreen_android12.png
anthonyStratis commented 12 months ago

@labrujasiete Android 12 has an issue where it doesn't show the app icon on the splash screen when launched from another process (https://issuetracker.google.com/issues/205021357). That may also apply to using image, I'm not sure.

Try force killing the app then running if from the device launcher and see if the image shows up.

labrujasiete commented 12 months ago

@labrujasiete Android 12 has an issue where it doesn't show the app icon on the splash screen when launched from another process (https://issuetracker.google.com/issues/205021357). That may also apply to using image, I'm not sure.

Try force killing the app then running if from the device launcher and see if the image shows up.

Yes, i've already come across this tip and i've already tried force killing the app and launching it from the device launcher, as suggested, but the issue persists.

vko85 commented 11 months ago

on Android 12, flutter 3.16.3 white screen:

flutter_native_splash:
background_image: assets/splash.png
image: assets/appicon.png
web: false
android_gravity: clip_horizontal
ios_content_mode: scaleAspectFill

I experienced the issue after upgrading flutter from 3.10.5.

jonbhanson commented 11 months ago

@jibbers42 yes, icon_background_color should set the color of your icon's background. Do you have areas of transparency in your icon where the background color can show through? Also, have you tried changing the color to something like "#FF0000" to see if it shows through? I don't believe Android 12+ supports full screen splash screens.

jibbers42 commented 11 months ago

@jibbers42 yes, icon_background_color should set the color of your icon's background. Do you have areas of transparency in your icon where the background color can show through? Also, have you tried changing the color to something like "#FF0000" to see if it shows through? I don't believe Android 12+ supports full screen splash screens.

The provided config does not specify an image for android_12, so it should use the launcher icon. I used this project's example app with the default flutter icons which does seem to use a transparent background.

Given this config on API 33:

flutter_native_splash:
  color: "#00ff00"
  image: "assets/splash.png"

  android_12:
    color: "#00ff00"
    icon_background_color: "#ff0000"

  ios: false
  web: false
  android_gravity: fill
  fullscreen: true

I get: image

It seems like the white in the icon should be red, unless I'm misunderstanding something.

labrujasiete commented 11 months ago

@jibbers42 I'm not sure if it supports transparency in the end, so i think we should make the icon image to the desire color, Everything else seems to be working fine, as to API 33

lauriewu1 commented 9 months ago

I've been experiencing similar struggles as well. Adding a comment to bump the issue.

AK47-23 commented 9 months ago

The background image is not shown even though I gave background_image(issue only in android 12+).

My configuration:

flutter_native_splash:
  image: assets/rdr.png
  background_image: assets/sc.png
  fullscreen: true
  android_gravity: fill
  ios_content_mode: center

  android_12:
    image: assets/rdr.png
    background_image: assets/sc.png
    fullscreen: true
    android_gravity: fill
    ios_content_mode: center

  web: false

[✓] Flutter (Channel stable, 3.16.9, on Ubuntu 22.04.3 LTS 6.5.0-17-generic, locale en_IN) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2023.1) [✓] Android Studio (version 2021.2) [✓] IntelliJ IDEA Community Edition (version 2023.1) [✓] VS Code (version unknown) ✗ Unable to determine VS Code version. [✓] Connected device (3 available) [✓] Network resources

• No issues found!

stwarwas commented 9 months ago

I observe similar issues as mentioned above.

morhi-2214 commented 9 months ago

Thank you for the wonderful package.

I have experienced a similar issue. After upgrading Flutter SDK from version 3.7.8 to 3.19.1, the image specified for the splash screen is not displayed only on the first launch of the app.

environment:
  sdk: ">=3.0.0 <4.0.0"
# ...
dependencies:
  flutter_native_splash: ^2.3.10
# ...
flutter_native_splash:
  color: "#ffffff"
  image: "assets/img/logo_splash.png"
  color_dark: "#ffffff"
  image_dark: "assets/img/logo_splash.png"
  android_12:
    icon_background_color: "#ffffff"
    image: "assets/img/logo_splash_android.png"
    icon_background_color_dark: "#ffffff"
    image_dark: "assets/img/logo_splash_android.png"
afzl-wtu commented 8 months ago

I am using on Android 14. I am facing similar issues Also I can not set color to white if device is in dark mode as stated in issue #485. Icon background color has no effect and I can not set custom image as my splash screen

nuriulgen commented 6 months ago

@afzl-wtu Did you find any solution?

RoyalCoder88 commented 4 months ago

any solution for this issue :(?

hsynucak commented 4 months ago

?

shihabmi7 commented 2 months ago

any solution ?

workerbee22 commented 2 weeks ago

Any solution?

jonbhanson commented 1 week ago

@jibbers42 based on my testing it seems that if Android uses the app icon (in the example this comes from mipmaps), the transparency in the image turns into a white background. I do not know why this is the case. If I set an image in the config and run the create command, then the icon background color shows in the transparent areas as expected.