Home > Software design >  Flutter: Android resource linking failed
Flutter: Android resource linking failed

Time:07-08

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?

CodePudding user response:

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

  • Related