Evgeni Roitburg
Evgeni Roitburg

Reputation: 2097

Manifest Merger tools:replace doesnt have any effect

Im using image-chooser-library in my app, which has android:icon defined so i need to override this attribute for gradle to build successfully:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.sample.sample">

    <application
        android:icon="@drawable/icon"
         tools:replace="icon"/>

</manifest>

But still im getting the following:

Manifest merger failed : Attribute application@icon value=(@drawable/icon) from AndroidManifest.xml:20:9 is also present at com.kbeanie:image-chooser-library:1.4.3:13:9 value=(@drawable/ic_launcher) Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:15:5 to override

Any suggestions?

Upvotes: 3

Views: 3658

Answers (3)

Tibi
Tibi

Reputation: 131

I had the same issue and because it happened on multiple build machines and when creating a test project with just the library causing the issue, everything worked fine, I was suspecting some bug in manifest merging tool.

I fixed it by changing the order of dependencies in gradle file (the library causing the issue was the last in list and I moved it on top).

Upvotes: 13

codezjx
codezjx

Reputation: 9142

You can try to add useOldManifestMerger true in your build.gradle file (in android{} tag), but this feature is remove from the 1.0.0 gradle plugin version.

Or add tools:replace="android:icon" to your AndroidManifest.xml. (Warnning: you should add xmlns:tools="http://schemas.android.com/tools" in <manifest/> tag at first)

For more infomation about manifest merger, you can visit the Official Document.

Upvotes: 2

bytehala
bytehala

Reputation: 675

I checked it on my manifest, it's

tools:replace="android:icon"

not just "icon"

Upvotes: 0

Related Questions