Error solution: build failed due to use of deprecated android v1 embedding in flutter

If you left your project a long time ago and returned now, you have a few things to change, but they are simple if you know them:

Manifest Change whatever you have written before here with:

<application android:name="${applicationName}"

add in <application..:

<application android:exported="true"...>
<meta-data
    android:name="flutterEmbedding"
    android:value="2" />..

In the main theme of the Activity main attention to correct with:

<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="your theme" />

Hope you have the kotlin class as a reference, so you can go in the case of MainActivity.kt:

package com.yourpackage.....
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
 //If you have some native code put it back
}

If you have Java Activity Main:

package com.yourpackage.....

import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
// You can keep this empty class or remove it.  
}

It is also worth updating targetSdkVersion and compileSdkVersion, in my case at 31

Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime