Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:16:5-39:19 to override

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>
like image 595
Samir Dangal Avatar asked Feb 28 '19 11:02

Samir Dangal


People also ask

How do I change AndroidManifest XML?

Open your Android project and go to <AppProjectFolder>/app/src/main/. Open the app manifest file AndroidManifest. xml and add the following lines to the file as child elements of the <manifest> element. Note: You must include the QUERY_ALL_PACKAGES permission if your app targets Android 11 (API Level 30) or higher.

What is the Android name attribute used for in the AndroidManifest XML file?

android:label represents a label i.e. displayed on the screen. android:name represents a name for the activity class. It is required attribute.

How do I fix manifest merger failed?

Try adding the following labels to resolve the issue: Add the xmlns:tools line in the manifest tag. Add tools:replace= or tools:ignore= in the application tag.

Where can I find AndroidManifest XML file?

It is located under android folder inside your monaca project as shown below: For Cordova 6.2 or higher, AndroidManifest.


1 Answers

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"
    package="nz.co.plumbingworld.flutterblocpattern">
like image 191
shadowsheep Avatar answered Sep 24 '22 01:09

shadowsheep