18
votes

Just updated to the latest version of Android Studio and i get this error in the AndroidManifest file

Manifest merger failed : Attribute application@icon value=(@drawable/project_launcher_icon) from AndroidManifest.xml:48:9 is also present at com.github.anupcowkur:reservoir:1.1.1:6:45 value=(@drawable/ic_launcher) Suggestion: add 'tools:replace="icon"' to element at AndroidManifest.xml:44:5 to override

I tried adding tools:replace="@drawable/ic_drawer" in my manifest but i get this error:

Error:(44, 5) tools:replace specified at line:44 for attribute tools:drawable/ic_drawer, but no new value specified

Any ideas?

5
I would like to know what are the changes expected in our manifest files in order to make them compatible with the new merger. - David Ameller
Have you considered changing the accepted answer for this @connector ? - Carl Anderson
please tell me one thing tools:replace should i add this inside application tag of my project manifest or inside application tag of my library please tell me it will be really helpful for me ?? - Sudhanshu Gaur

5 Answers

41
votes

Following Android Studio's suggestion and adding the following attribute tools:replace="icon" should allow it to build your app successfully, without resorting to using the old manifest merger (which isn't a very forward-looking solution indeed).

Of course, you'll first have to declare the namespace "tools" in order to use it:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              package="com.sample.app" >
9
votes

You should add tools:replace="icon", just like the error message says.

Additional attributes can be replaced using the syntax tools:replace="icon,name,theme"

9
votes

look here: All markers belong to the Android tools namespace, therefore you must declare the namespace in any AndroidManifest.xml containing at least one marker : xmlns:tools="http://schemas.android.com/tools"

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tests.flavorlib.app"
**xmlns:tools="http://schemas.android.com/tools"**>

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name"
   **tools:replace=”icon, label”**/>
</manifest>

you should add xlms:tools and tools:replace those two lines in manifest file.

4
votes

Android Studio 0.6 use the new manifest merger tool. This new merger was introduced in version 0.10 of the plugin. As of 0.11, this tool is used by default by the gradle plugin.

In order to revert to the old manifest merger, please add to your build.gradle the following configuration :

android { useOldManifestMerger true }

4
votes

For me this worked. Try adding the code in the main module(project) manifest file:

add xmlns:tools="http://schemas.android.com/tools" in your manifest tag

add tools:replace="android:icon,android:label,android:theme" in your application tag

These will let Android Studio know that the icon, label and theme to be used are from that manifest and not from other projects included.