When running an old flutter project, an error is reported:Warning: Your Flutter application is created using an older version of the Android embedding. It's being deprecated in favor of Android embedding v2.
Solution:
-
Open the AndroidManifest.xml file under the app folder in the android directory, and add the following code below the activity tag:
<meta-data android:name="flutterEmbedding" android:value="2" />
-
android:name="io.flutter.app.FlutterApplication"
Change toandroid:name="${applicationName}"
-
Add this sentence in the defaultConfig of app/build.gradle:
manifestPlaceholders = [applicationName: "android.app.Application"]