Search code examples
androidflutterandroid-manifestandroid-splashscreen

Flutter Android Splash Screen always black


Oddly enough my android apps splash screen is white on my android emulator but black on my personal phone when I load the APK on it.

When I went to investigate I see this in the Android manifest:

    <meta-data
        android:name="io.flutter.embedding.android.NormalTheme"
        android:resource="@style/NormalTheme"
    />

And when I go to res drawable I see a file called launch_background.xml which sounds promising.

But when I look inside it, it shows:

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/white" />

    <!-- You can insert your own image assets here -->
    <!-- <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/launch_image" />
    </item> -->
</layer-list>

Which is odd because it says its white. So I am not sure what I am missing on why my cell phone boots it black. I want to make the splash screen background color white for everyone.


Solution

  • create a new file named color.xml in values in given route => your_project_name\android\app\src\main\res\values and add this code.

    <?xml version="1.0" encoding="utf-8"?>
        <resources>
            <color name="background_color">#ffffff</color>
        </resources>
    

    after that use this line in both drwables under layer-list tag

    <item android:drawable="@color/background_color" />
    

    this will solve your issue