Reputation: 91
I have this problem. Plz let me know how to solve this problem.. I got this git code from a lesson made about 2years ago. Also different errors showed up when I made a flutter project using git code.
-> This is the problem 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.
Upvotes: 5
Views: 21659
Reputation: 31
you should to add a config in your manifest:
<meta-data
android:name="flutterEmbedding"
android:value="2" />
Add a new tag under .
and change name in manifest like this :
android:name="${applicationName}"
Upvotes: 0
Reputation: 377
step 1: In android studio go to "android/app/src/main/java/[your/package/name]/MainActivity.java" and remove everything except package at the top paste the following as it is
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
step 2: Open "android/app/src/main/AndroidManifest.xml", under <application
change
android:name="io.flutter.app.FlutterApplication"
to
android:name="${applicationName}"
Remove all <meta-data>
tags with key android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
and paste
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
at its place
step 3: Add the following below the end of application tag i.e. below </application>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
step 4: In terminal run flutter clean
Upvotes: 0
Reputation: 389
If the application is very old, you should consult the migration guide that the documentation or fial offers you, just like the other answers recommend.
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
but if you still have the deprecated application warnning try the following
flutter clean
rm pubspec.lock
flutter pub upgrade --major-versions
(this command will update all the libraries you have, be careful, before evaluating if such an update is necessary in your project).then you must make some changes at the android folder level
change the gradle.zip in android/gradle/wrapper/gradle-wrapper.properties
to a newer version like:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
and in android/build.gradle
update the version to
classpath 'com.android.tools.build:gradle:7.1.2'
the kotlin version in : ext.kotlin_version = '1.6.10'
and if you were using code obfuscation with proguard-rules.pro
remove any added configurations that reference that file in android/app/build.gradle
and you should be left with just this
buildTypes {
release {
signingConfig signingConfigs.release
}
}
finally close the code editor or the IDE you use
and in console run flutter pub get
and run your project flutter run
Last but not least, do not forget to update the build version of your application to API 33 or higher and have your android studio updated (VERY IMPORTANT FOR UPDATE, ) android-studio
Upvotes: 2
Reputation: 111
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"
...
Upvotes: 11
Reputation: 8635
This has been answered before here on SO.
Here: Your Flutter application is created using an older version of the Android embedding
And here: How to Fix Flutter Warning: Your Flutter application is created using an older version
You can also look at the source of how to migrate here: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
Upvotes: 0