6

I am getting this error

Error: Attribute application@label value=(flutter_bloc_pattern) from AndroidManifest.xml:18:9-45 is also present at [:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41 value=(@string/app_name).

Build failed with error

 C:\Users\user\AndroidStudioProjects\Flutter Example\Flutter BLoC Pattern\android\app\src\main\AndroidManifest.xml:18:9-45 Error:
        Attribute application@label value=(flutter_bloc_pattern) from AndroidManifest.xml:18:9-45
        is also present at [:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41 value=(@string/app_name).
        Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:16:5-39:19 to override.

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : Attribute application@label value=(flutter_bloc_pattern) from AndroidManifest.xml:18:9-45
        is also present at [:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41 value=(@string/app_name).
        Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:16:5-39:19 to override.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 3s
    Finished with error: Gradle task assembleDebug failed with exit code 1

And my Manifest is this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="nz.co.plumbingworld.flutterblocpattern">

    <!-- The INTERNET permission is required for development. Specifically,
         flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="flutter_bloc_pattern"
        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"
            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>
        </activity>
    </application>
</manifest>
Zoe
  • 27,060
  • 21
  • 118
  • 148
Samir Dangal
  • 2,591
  • 2
  • 15
  • 17
  • This may help https://stackoverflow.com/questions/25981156/tools-replace-not-replacing-in-android-manifest – shadowsheep Feb 28 '19 at 12:10
  • I got this kind of error when using the PayHere library as well. I am posting this comment if anyone have trouble with this error when using PayHere, they can follow the Answer given here – Dilini Peiris Jun 24 '19 at 05:50

1 Answers1

27

The error message is telling you that in you AndroidManifest.xml your android:label with value flutter_bloc_pattern is already present in the manifest of (library/plugin/project) DynamsoftBarcodeReader.

You could, as the error says, add tools:replace="android:label" to your <application> node in your manifest

<application
    tools:replace="android:label"
    android:name="io.flutter.app.FlutterApplication"
    android:label="flutter_bloc_pattern"
    android:icon="@mipmap/ic_launcher">

If you add the tools attribute you need also to add the schema

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
Jerry Shang
  • 25
  • 1
  • 6
shadowsheep
  • 14,048
  • 3
  • 67
  • 77