Photo by Andreas Schnabl from Pexels

How to Resolve Deprecated Android Embedding in Flutter ? Solution

Binni G. πŸŽ§πŸ¦‹
2 min readJan 2, 2022

--

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:

Android Embedding Deprecated Warning
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 at
https://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:

Code in Android Manifest

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

--

--