148

I keep seeing this message and not sure how to solve it for good.

Error:(43, 9) Attribute application@icon value=(@drawable/new_app_icon) from AndroidManifest.xml:43:9
    is also present at com.github.erizet.signala:signala-longpolling:0.20:7:18 value=(@drawable/ic_launcher)
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:40:5 to override
:OpenBook:processDebugManifest FAILED
Error:Execution failed for task ':OpenBook:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

Tried adding android:replace="android:icon" to my manifest even with my icon.

I tried deleting the android:icon="@drawable/ic_launcher from the library but it keeps coming back when i build because its imported from maven

Any ideas ?

shimi_tap
  • 7,822
  • 5
  • 23
  • 23

18 Answers18

359

It seems to be the fault of the mainfest Merger tool for gradle.

http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger

Solved it by adding to my manifest tag xmlns:tools="http://schemas.android.com/tools"

Then added tools:replace="android:icon,android:theme" to the application tag

This tells the merger to use my manifest icon and theme and not of other libraries

Muhammad Dyas Yaskur
  • 6,914
  • 10
  • 48
  • 73
shimi_tap
  • 7,822
  • 5
  • 23
  • 23
  • 6
    The problem still persists for me. Working in Android Studio 1.1. – Bolling Apr 01 '15 at 05:14
  • Worked for me. Perfect Solution, Basically they have upgraded the Migration system and not allowing the old manifest merger system. To avoid conflicts between elements to be merged, some markers have been added to guide the Manifest Merger. – sud007 Apr 29 '15 at 10:06
  • Working in Android Studio 1.2 – WarsClon Jun 04 '15 at 09:14
  • 1
    It worked to me with `xmlns:tools="http://schemas.android.com/tools"` on `` tag and `tools:replace="icon"` on `` tag – Mikel Sep 23 '15 at 09:35
  • If some body still has the same problem and this solution is not working, then you can try to add "android:allowBackup" to the tools:replace like this (Ex. tools:replace="android:allowBackup,android:icon,android:theme") – Stoycho Andreev Apr 06 '16 at 14:59
  • did you add > tools:replace="android:icon,android:theme" < to the library or to your app ? – Thiago Apr 08 '16 at 03:32
  • I just added the jar in Libs folder instead to give the dependency in .gradle file. – ManMohan Apr 27 '16 at 13:10
  • 4
    Latest versions of android 2.0. not working. Whoever answered should update this Q if he meant saving generations else it will be useless soon – Karue Benson Karue Jun 21 '16 at 22:43
  • 3
    Studio 2.2 from today all having this and nt working this issue – Prasad Sep 28 '16 at 06:47
  • 2
    not working for Android Studio 2.2 with gradle 2.2.0. – DysaniazzZ Nov 25 '16 at 03:55
  • Working on Android Studio 2.2.3, you rocks! – David Jan 10 '17 at 12:28
  • Note: The posted link has since been replaced / migrated to the new URL: https://developer.android.com/studio/build/manifest-merge.html#attribute_markers – HelloImKevo Sep 08 '21 at 20:16
57

I have same issue , I fix it like this by adding xmlns:tools="http://schemas.android.com/tools" to the top of mainfest file , and add tools:replace="android:icon" to be look like

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"  // add tools line here 
    package="yourpackage">


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon"> ///add this line 

.....

</application>

</manifest>
Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156
12

i have same error , just this code solve my problem , i want to share with you :

in Manifest.xml :

  • add this code in top of your xml file :

    xmlns:tools="http://schemas.android.com/tools"

  • Then added :

    tools:replace="android:icon,android:theme,android:label,android:name" to the application tag

Community
  • 1
  • 1
Adnan Abdollah Zaki
  • 4,328
  • 6
  • 52
  • 58
9

The answer of shimi_tap is enough. What to be remembered is that choosing only what you need. Choose from {icon, name, theme, label}. I added tools:replace="android:icon,android:theme", it does not work. I added tools:replace="android:icon,android:theme,android:label,android:name", it does not work. It works when I added tools:replace="android:icon,android:theme,android:label". So find out what the conflict exactly is in your manifest files.

黄锐铭
  • 311
  • 4
  • 5
5

Just add xmlns:tools="http://schemas.android.com/tools" to your manifest tag, and then you need to add tools:replace="android:icon" before android:icon="@mipmap/ic_launcher".

AStopher
  • 4,207
  • 11
  • 50
  • 75
Ilya S
  • 751
  • 1
  • 10
  • 10
3

This error also occurs when your app's minSdk is higher than any library's minSdk.

app's minSdk >= libraries minSdk
Hisham Muneer
  • 8,558
  • 10
  • 54
  • 79
2

GOT THE SOLUTION AFTER ALOT OF TIME GOOGLING

just get your ic_launcher and paste it in your drawables folder,

Go to your manifest and change android:icon="@drawable/ic_launcher"

Clean your project and rebuild

Hope it helps you

Ismael ozil
  • 573
  • 5
  • 6
2

I had this problem changing the icon from drawable to mipmap.

I only missed the line

tools:replace="android:icon"

in the manifest.

Alecs
  • 2,900
  • 1
  • 22
  • 25
1

For some reason android studio doesn't like calling app icon from drawable folder. So in that case I created mipmap resource directory under res folder.

Right click res folder > new > android resource directory > resource type: mipmap and now drop any icon in there then reference that into manifest file. Sharing this since this method worked for me.

android:icon:@drawable/ic_launcher"

to

android:icon="@mipmap/ic_launcher"

Alex
  • 1,052
  • 1
  • 11
  • 22
  • for me setting the style seemed best `android:theme="@style/AppTheme"` see -> https://gist.github.com/CrandellWS/4d284b11b5bca3054bddf8f511e49ae9 – CrandellWS Apr 22 '16 at 18:56
1

If nothing of that work, close Android Studio. Go on app/src/main, open the file AndroidManifest.xml in a text editor (like sublime), remove/replace the erros lines, save and reopen android studio.

Ricardo Mutti
  • 2,639
  • 2
  • 19
  • 20
1

When an attribute value contains a placeholder (see format below), the manifest merger will swap this placeholder value with an injected value. Injected values are specified in the build.gradle. The syntax for placeholder values is ${name} since @ is reserved for links. After the last file merging occurred, and before the resulting merged android manifest file is written out, all values with a placeholder will be swapped with injected values. A build breakage will be generated if a variable name is unknown.

from http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-Build-error

0

Shimi_tap's answer is the right way to fix the problem. If you want to use old merger tool you can add this to build.gradle file

android { useOldManifestMerger true }

San
  • 5,567
  • 2
  • 26
  • 28
  • 2
    "In 1.0, we removed the ability to invoke the old manifest merger. .." http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger – Dev Gurung Apr 07 '15 at 23:55
  • Could not find method useOldManifestMerger() for arguments [true] on project ':app' of type org.gradle.api.Project. – DysaniazzZ Nov 25 '16 at 04:00
0

For me, this issue occurred after updating Google Play Services. One of the libraries I was using incorporated this library using the "+" in its gradel reference, like

compile 'com.google.android.gms:play-services:+'

This created an issue because the min version targeted by that library was less than what was targeted by the current version of Google Play Services. I found this by simply looking in the logs.

Rarw
  • 7,645
  • 3
  • 28
  • 46
0

In your .gradle change MinSDK, for example:

  • build.gradle (Module: app)
    • before: minSdkVersion 9
    • after: minSdkVersion 14

etc.

Dev-iL
  • 23,742
  • 7
  • 57
  • 99
0

I tried all the solution mentioned above

in Manifest.xml :

  • add this code in top of your xml file within manifest tag:

    xmlns:tools="http://schemas.android.com/tools"

  • Then added :

    tools:replace="android:icon,android:theme,android:label,android:name" to the application tag

but none of it worked. I needed to delete a xml file which was situated in

mipmap-anydpi-v26/ic_launcher_round.xml

I was testing the application in

Samsung Galaxy 8 with OS version 8.0.0

is it really a solution?

Community
  • 1
  • 1
surhidamatya
  • 2,419
  • 32
  • 56
0

Within the AndroidManifest.xml file, add the following to the application node:

tools:replace="android:appComponentFactory,android:icon,android:theme,android:label,android:name"
AStopher
  • 4,207
  • 11
  • 50
  • 75
M E S A B O
  • 783
  • 1
  • 11
  • 15
0

This issue occurs when you add a third-party library with @drawable/ic_launcher attribute thus android merger is unable to differentiate your app icon attribute and the library's attribute. To solve this add this line in your manifest file under the application tag

tools:replace="android:icon"
0

And update for Android Studio - Arctic Fox

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    // DOCS: This is where we add the xmlns:tools reference
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.app">
    // Permissions would go here
    // ...
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        ...
        tools:ignore="GoogleAppIndexingWarning"
        // DOCS: If you dont add this entry the xmlns:tools ref will not be found
        tools:replace="android:icon">
        <activity
            android:name=".MainActivity"
            android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
alanionita
  • 1,272
  • 1
  • 16
  • 34