Flutter: Android资源链接失败



在android模拟器中运行我的Flutter应用程序时出现以下错误:

Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR:/Users/rgb/Repositories/member_app_flutter/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:47: AAPT: error: unexpected element <style> found in <manifest><application><activity>.

这是我的AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.xxx.app">
<application
android:name="${applicationName}"
android:label="XXX"
android:icon="@mipmap/launcher_icon">
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:exported="false"
android:windowSoftInputMode="adjustResize">

<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

不确定为什么会出问题?我假设样式标签在正确的地方?

似乎<style>添加到manifest file而不是styles.xml文件

应该在里面:<project>/android/app/src/main/res/values/styles.xml

not in<project>/android/app/src/main/AndroidManifest.xml

最新更新