简体   繁体   中英

Flutter: Android resource linking failed

Getting the following error when trying to run my Flutter app in an android simulator:

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>.

Here is my 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>

Not really sure why it is acting up? I assume the style tag is in the right place?

seems to be <style> added in manifest file instead of styles.xml file

It should be inside : <project>/android/app/src/main/res/values/styles.xml

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM