How to migrate Older Version of Flutter to Flutter Android Embedding 2

In order to better support the execution environments of adding Flutter to an existing project, the old Android platform-side wrappers hosting the Flutter runtime at and their associated classes are now deprecated. New wrappers at and associated classes now replace them.

Your existing full-Flutter projects aren’t immediately affected and will continue to work as before for the foreseeable future.

To migrate your project, follow the following steps:

  • Remove the body of your or MainActivity.kt and change the FlutterActivity import. The new FlutterActivity no longer requires manually registering your plugins. It will now perform the registration automatically when the underlaying FlutterEngine is created. your file should be like this

class MainActivity: FlutterActivity() { 


If you had existing custom platform channel handling code in your or MainActivity.kt then move the channel registration part of the code in your onCreate into the configureFlutterEngine override of the FlutterActivity subclass and use flutterEngine.getDartExecutor().getBinaryMessenger() as the binary messenger rather than getFlutterView().

  • Open android/app/src/main/AndroidManifest.xml.
  • Remove the reference to FlutterApplication from the application tag. and your file should be like this

Previous configuration:

android:name=""    >    
<!-- code omitted --> 

New configuration:

<application   >   
<!-- code omitted --> 
  • Update splash screen behavior (if splash behavior is desired).In AndroidManifest.xml remove all <meta-data> tags with key android:name="".
  • Add a new <meta-data> tag under <application>.
android:value="2" /> 
enter image description here


Leave a Comment

Your email address will not be published. Required fields are marked *