Saturday, October 9, 2021

Even on newly created Flutter v2.5 project getting "A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.'

Even on a newly created project using latest Flutter v2.5.1 and/or latest Android Studio Arctic Fox 2020.3.1 Patch 2

Running a project will show the following warning 

A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps. 

> flutter run
Using hardware rendering with device AOSP on IA Emulator. If you notice graphics
artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...                             33.6s
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...                 3.5s
W/FlutterActivityAndFragmentDelegate(12509): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
D/eglCodecCommon(12509): setVertexArrayObject: set vao to 0 (0) 1 0
Syncing files to device AOSP on IA Emulator...                     179ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
💪 Running with sound null safety 💪
An Observatory debugger and profiler on AOSP on IA Emulator is available at:
http://127.0.0.1:62763/lMsd46bI0HBdfc=/
The Flutter DevTools debugger and profiler on AOSP on IA Emulator is available
at: http://127.0.0.1:9101?uri=http://127.0.0.1:62763/lMsd46bI0HBdfc=/


Solution:

Remove the following code from (project folder)/android/app/src/main/AndroidManifest.xml

<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>

From flutter.dev site:

This is no longer needed and is deprecated – Flutter now automatically keeps the Android launch screen displayed until Flutter has drawn the first frame. Developers should instead remove usage of these APIs.



No comments: