Home > Software design >  No `<meta-data android:name="flutterEmbedding" android:value="2"/>` in &qu
No `<meta-data android:name="flutterEmbedding" android:value="2"/>` in &qu

Time:03-14

Trying to run a Flutter application with the flutter run command produces the following error:

No `<meta-data android:name="flutterEmbedding" android:value="2"/>` in   "..\src\main\AndroidManifest.xml"

Here is my AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.coding.informer.simple_material_app">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application android:name="${applicationName}" android:label="simple_material_app" android:icon="@mipmap/ic_launcher">
        <activity android:name=".MainActivity"
                  android:launchMode="singleTop"
                  android:theme="@android:style/Theme.Black.NoTitleBar"
                  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
                  android:hardwareAccelerated="true"
                  android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

I'm aware that the error message offers an obvious solution but I want to post my answer here so that anyone else running into this error can resolve it quickly.

CodePudding user response:

The problem was that the AndroidManifest.xml file was lacking a required <meta-data android:name="flutterEmbedding" android:value="2"/> tag. Add it like so:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.coding.informer.simple_material_app">

    <uses-permission android:name="android.permission.INTERNET"/>
    <meta-data android:name="flutterEmbedding" android:value="2"/>

    <application android:name="${applicationName}" android:label="simple_material_app" android:icon="@mipmap/ic_launcher">
        <activity android:name=".MainActivity"
                  android:launchMode="singleTop"
                  android:theme="@android:style/Theme.Black.NoTitleBar"
                  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
                  android:hardwareAccelerated="true"
                  android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

CodePudding user response:

It will inside application tag. Please see attached :enter image description here

So your manifest fill wiil be look like this :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.coding.informer.simple_material_app">

    <uses-permission android:name="android.permission.INTERNET"/>
    

    <application android:name="${applicationName}" android:label="simple_material_app" android:icon="@mipmap/ic_launcher">
        <activity android:name=".MainActivity"
                  android:launchMode="singleTop"
                  android:theme="@android:style/Theme.Black.NoTitleBar"
                  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
                  android:hardwareAccelerated="true"
                  android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>


  <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

    </application>
</manifest>
  • Related