How to Resolve Deprecated Android Embedding in Flutter ? Solution
Introduction
Are you experiencing issues with your Flutter app due to the deprecated version of Android embedding? Donβt worry, youβre not alone. This error can be frustrating and time-consuming to fix, especially if youβre not familiar with the process. But donβt let this problem slow down your app! In this blog post, weβll walk you through a step-by-step guide on how to fix the deprecated Android embedding error in Flutter. Our expert tips and solutions will have your app up and running smoothly in no time. So letβs get started!
Understanding the Problem
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
Causes of the Error
This is because it is using an using an older version of the Android
embedding.
Fixing the Error
To solve this error, Add the following code in AndroidManifest.xml file that is present in folder β android/app/src/main/ .
<!-- Add this meta-data.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<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.
Conclusion
In conclusion, we hope that this guide has helped you fix the deprecated Android embedding error in your Flutter app. There are several solutions available, but adding the <meta-data> tag in the AndroidManifest.xml file is one of the simplest and most effective. By upgrading your app, youβll be able to provide a better user experience and take advantage of the latest features in Flutter. Remember, itβs important to keep your app updated and optimised for your users. Happy coding!
Thanks For Reading, Follow Me For More