The Error “Build failed due to use of deprecated Android v1 embedding.”, is an error that is invoked when you are working on building a flutter app. Given below is the snippet of the error you might get:
Build failed due to use of deprecated Android v1 embedding.
I would like to share with you the steps I took to fix the “Build failed due to use of deprecated Android v1 embedding.”
Why “Build failed due to use of deprecated Android v1 embedding” Error is Seen?
The error, “Build failed due to use of deprecated Android v1 embedding.” is seen because, there should be some lines of code in your AndroidManifest.xml file which are missing.
These lines of code are needed as they are used by the Flutter tool to generate GeneratedPluginRegistrant.java.
The detailed solution to fix the error “Build failed due to use of deprecated Android v1 embedding.”, is given below:
How to Fix “Build failed due to use of deprecated Android v1 embedding” Error?
To fix the error, you will have to update your AndriodManifest.xml file using code <application android:name=”${applicationName}” which you might be missing into your code. Once done, it would fix the error Build failed due to use of deprecated Android v1 embedding for you.
To fix the error, “Build failed due to use of deprecated Android v1 embedding.”, you will have to follow the steps mentioned below:
First you will have to change your AndroidManifest.xml file by following the path mentioned here: android\app\src\main\AndroidManifest.xml.
Your old AndroidManifest.xml file will look something like this :
<application
android:name="io.flutter.app.FlutterApplication"
...
You will have to change this AndroidManifest.xml file to the below mentioned code:
<application
android:name="${applicationName}"
...
Please make sure to add these lines of code if they are not present in your AndroidManifest.xml file:
<meta-data
android:name="flutterEmbedding"
android:value="2" />
...
This should fix the error “Build failed due to use of deprecated Android v1 embedding.”.
Conclusion
To fix the error “Build failed due to use of deprecated Android v1 embedding.”, you will have to update your AndriodManifest.xml file which you are using.