简体   繁体   中英

How do I resolve this firebase messaging error in the androidmanifest.xml of my flutter application?

I was following the steps here, https://pub.dev/packages/firebase_messaging#-readme-tab- , to display notifications in my emulator, but I am getting this error in the flutter terminal,

What went wrong: Execution failed for task ':app:generateDebugBuildConfig'. org.xml.sax.SAXParseException; systemId: file:/C:/Users/steve/Repos/off-top-flutter/android/app/src/main/AndroidManifest.xml; lineNumber: 17; columnNumber: 44; Attribute "name" bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "application".>

Below is my code in the AndroidManifest.xml:

<application
        android:name=".Application"
        android:name="io.flutter.app.FlutterApplication"
        android:label="off_top_mobile"
        android:icon="@mipmap/ic_launcher">
        <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:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>


            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>

    </application>

You have the android:name attribute specified twice in your application element:

<application
        android:name=".Application"
        android:name="io.flutter.app.FlutterApplication"

You can have only one. You probably just want to keep whichever one you started with, and not the one you added.

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