Home > Back-end >  Why do I get a warning when creating a custom slash screen?
Why do I get a warning when creating a custom slash screen?

Time:12-24

Why do I get this warning when I try to create my custom splash screen? Warning Screenshot

Can I get rid of this without using @SuppressLint("CustomSplashScreen")

CodePudding user response:

Probably because with android-12 there is a new API to build Splash Screen . You can go through the migration guide if you want to implement new API . If you want keep older one you have to use @SupressLint because you are targeting android-12.

CodePudding user response:

Why do I get this warning when I try to create my custom splash screen?

You are encouraged to migrate to the SplashScreen API that is available on Android 12, with a backport available in AndroidX libraries (currently alpha).

Can I get rid of this without using @SuppressLint("CustomSplashScreen")

There are some other ways to suppress lint warnings such as using an XML file or configuring it with gradle. In this case I'd prefer the @SuppressLint annotation since it's the most local.

Or, just get rid of your custom splash screen to keep lint happy here.

  • Related