试图使用flutter run命令运行颤振应用程序会产生以下错误:
No `<meta-data android:name="flutterEmbedding" android:value="2"/>` in "..\src\main\AndroidManifest.xml"这是我的AndroidManifest.xml文件:
<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>我知道错误消息提供了一个明显的解决方案,但我想在这里发布我的答案,以便任何其他遇到此错误的人都能快速解决它。
发布于 2022-03-14 00:53:10
问题是AndroidManifest.xml文件缺少必需的<meta-data android:name="flutterEmbedding" android:value="2"/>标记。添加如下:
<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>发布于 2022-06-05 19:19:36
将以下代码添加到android > app > src >main > AndroidManifest.xml中
<meta-data android:name="flutterEmbedding" android:value="2" />
发布于 2022-03-14 06:20:16
它将在应用程序标签中。请见附件:

所以你的舱单会是这样的:
<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>https://stackoverflow.com/questions/71462052
复制相似问题