8

I have a native splash screen in flutter, but when the splash screen ends, it has a fade animation to my app home screen. I need to remove that, and still use the native splash. How can I do that?

Márcio Valim
  • 2,459
  • 3
  • 10
  • 21

1 Answers1

1

Here is what I found:

  • Open your Android project inside your Flutter project
  • In you Android project, go to app/src/main/AndroidManifest.xml
  • in that AndroidManifest.xml file, you should find one activity block
  • in that block, comment or remove the two meta-data blocks, especially this one:
    <meta-data
        android:name="io.flutter.embedding.android.SplashScreenDrawable"
        android:resource="@drawable/launch-background" />

Not only the splash screen will still works, because you have android:theme=@style/LaunchTheme as attribute of the MainActivity, but il will also remove the glitch that you may have on your splash screen that shifts a little bit your logo (if you have one in your splash screen of course).

That solution works (at least for me) if you have a basic splash screen. I haven't tested that with a more advanced custom animated splash screen for example, so it might not be the perfect solution for everyone.

matteoh
  • 2,810
  • 2
  • 29
  • 54
  • The commenting out block results in android.content.res.Resources$NotFoundException: Resource ID #0x0 and app crash for my app. Both release and debug. – Dmytro Feb 14 '21 at 10:21
  • @Dmytro That's strange, since that block is not a Resource. I double checked on my project and that `meta-data` is commented and I don't have any issue. Maybe your problem comes from elsewhere? – matteoh Feb 14 '21 at 10:53
  • 1
    My app's Android builds are on stable latest channel - 1.22.6@Linux. For now I use recipe from https://github.com/flutter/flutter/issues/63156 – Dmytro Feb 14 '21 at 11:06
  • I think I found - I had additional custom splash screen loader which tried to reuse the data from manifest. My apologies for disturbing. – Dmytro Feb 15 '21 at 11:50
  • @Dmytro No worries! Glad you found it ;) – matteoh Feb 15 '21 at 12:23
  • @Dmytro could you explain your solution, if you've found it? I am using also this temporary method github.com/flutter/flutter/issues/63156 (left an answer there) but it does not work – riccardogabellone Nov 26 '21 at 16:11
  • We have finished with https://github.com/flutter/flutter/issues/63156#issuecomment-670390702 . iOS app wasn't a problem for customers (maybe it was smoother in release iOS builds already). – Dmytro Nov 27 '21 at 19:26