I am receiving the following warning on running a Flutter App. Kindly guide how to fix it
Warning: Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2.
I am receiving the following warning on running a Flutter App. Kindly guide how to fix it
Warning: Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2.
If you are here because of the flutter 2.10, do this:
Change this:
<application
android:icon="@mipmap/ic_launcher"
android:name="io.flutter.app.FlutterApplication"
android:label="PassesBox"
...
To this:
<application
android:icon="@mipmap/ic_launcher"
android:name="${applicationName}"
android:label="PassesBox"
...
You can add this to AndroidManifest.xml under activity tag.
<meta-data
android:name="flutterEmbedding"
android:value="2" />
This should remove the warning.
open your AndroidManifest.xml just remove this line
android:name="io.flutter.app.FlutterApplication"
If you haven't added any native-specific code to your iOS/android folder:
Delete the android and iOS files.
Then run flutter create . to fix the issue.
The command will recreate your Android and iOS file.
Easy as pie... just Do this... Always works. Change this in the AndroidMenifest.xml
<application
android:icon="@mipmap/ic_launcher"
android:name="io.flutter.app.FlutterApplication"
android:label="PassesBox"
...
To this:
<application
android:icon="@mipmap/ic_launcher"
android:name="${applicationName}"
android:label="PassesBox"
...
(The following API 28 can be replaced with 29 as well since it is the latest as of now. 28 is recommended)
Change your target SDK and compile SDK version to 28
Install API 28 from File -> Settings -> Appearance and Behaviour -> System Settings -> Android SDK -> SDK tools -> Select "Show package details from bottom right. Select all 28 versions, Apply.
Go to File -> Project Structure -> SDK's under Platform Settings -> Define Android API 28 as build target and enter the path for the SDK "C:\Users%USERNAME%\AppData\Local\Android\Sdk", Apply
Now, Go to modules under project settings in the same project structure, select Android API 28 from the dropdown. Restart the App.
The best thing to do is to copy all the files you work with, mostly any assets folders, the lib folder and your pubsec.yaml file into a separate folder.
Then, trash your project folder and create a new one.
Copy/replace the old files over and re-run it.
so sample create a new flutter project Click to File/New/New Flutter Project; then run it to make sure anything is perfect.
copy all code from the old project and past it in New which is created. make sure the Yamal file is also if you had changed on Yamal's. and more all the essential files copy and past it on a new project.
Just change this line:
io.flutter.app.FlutterActivity
with this:
io.flutter.embedding.android.FlutterActivity
in AndroidManifest
For more details check this url https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
You have to make 2 changes in AndroidManifest.xml
First change this:
<application
android:icon="@mipmap/ic_launcher"
android:name="io.flutter.app.FlutterApplication"
android:label="PassesBox"
...
To this:
<application
android:icon="@mipmap/ic_launcher"
android:name="io.flutter.embedding.android.FlutterActivity"
android:label="PassesBox"
...
And second change
Add this under activity tag
<meta-data android:name="flutterEmbedding" android:value="2" />
I had the same issue when I opened a project on a laptop, but created it on a pc. I went to android/app/src/build.gradle and checked the targetSdkVersion, on my project is 29. After I opened Android Studio, I clicked on the SDK Manager icon and checked which SDK version I have on my laptop, 30. So I installed 29 SDK version. I restarted Visual Studio Code and I tried "pub get" again and got no errors.
change this
<applicationandroid:name="io.flutter.app.FlutterApplication" > <!-- code omitted --></application>
to this
<applicationandroid:name="${applicationName}"><!-- code omitted -->`enter code here`</application>
first add this to AndroidManifest.xml under activity tag.
<meta-data
android:name="flutterEmbedding"
android:value="2"
/>
Then change this on AndroidManifest.xml under Application tag
android:name="io.flutter.app.FlutterApplication"
To this
android:name="${applicationName}"