Fix for Deprecated version of the Android embedding in Flutter
Running the Flutter code after downloading it from GitHub or some other source, sometime gives this warning in Android studio:
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps athttps://flutter.dev/go/android-project-migrationto migrate your project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
This is because it is using an using an older version of the Android
embedding.
So to solve this one option is to add the following code in AndroidManifest.xml file that is present in android/app/src/main/ folder :
<meta-data
android:name="flutterEmbedding"
android:value="2" />
Now your AndroidManifest file will look like this:
Now Simply Run your Flutter app again, and Voilà, it’s done. Warning will be gone now.
I have mentioned all the code required that I know. If you know other ways , share in the comments for everyone!
Thanks For Reading, Follow Me For More