flutter_native_splash icon indicating copy to clipboard operation
flutter_native_splash copied to clipboard

Splash screen stays white

Open lukehutch opened this issue 1 year ago • 2 comments

Describe the bug

I run flutter_native_splash:create, using the lines in pubspec.yaml shown below. This gives this output:

[Android] Creating default splash images
[Android] Updating launch background(s) with splash image path...
[Android]  - android/app/src/main/res/drawable/launch_background.xml
[Android]  - android/app/src/main/res/drawable-v21/launch_background.xml
[Android] Updating styles...
[Android]  - android/app/src/main/res/values-v31/styles.xml
[Android]  - android/app/src/main/res/values-night-v31/styles.xml
[Android]  - android/app/src/main/res/values/styles.xml
[Android]  - android/app/src/main/res/values-night/styles.xml
[iOS] Creating  images
[iOS] Updating ios/Runner/Info.plist for status bar hidden/visible
[Web] Creating images
[Web] Creating images
[Web] Creating background images
[Web] Creating CSS
[Web] Updating index.html

I see that drawable/background.png is created in the correct background color, at 1x1 pixel.

However, when I rebuild and run my app, the background stays white.

Configuration

flutter_native_splash:
  color: "#ffc107"
  image: assets/icon/icon-splash.png

Device (please complete the following information):

  • Device: Emulator
  • Android 33

To Reproduce

As above, 100% reproducibility, but I can't share the project, sorry.

What can I do to debug this further?

lukehutch avatar Jan 17 '24 13:01 lukehutch

To configure Android 12+ (API 33) you must use the android_12 section.

jonbhanson avatar Jan 17 '24 23:01 jonbhanson

Thanks, that works. Maybe the docs should be updated to more clearly indicated that this is needed for Android versions over 12, not just Android 12? Or maybe that should even be the default now, since it is very rare (especially in Flutter) to build apps for Android 11 or below, at this point.

Also, if I specify android_12, I still have to specify the color and/or image for earlier Android versions, otherwise I get an error.

Maybe the user could just specify the minimum Android SDK version to build for, and then flutter_native_splash could figure out what to build?

lukehutch avatar Jan 18 '24 01:01 lukehutch

Excellent suggestion, thank you. I have been planning to rework the plugin to be Android 12+ first, and the feedback from you and others confirms this is needed.

jonbhanson avatar Jan 28 '24 15:01 jonbhanson