Merge manifest tools: replacement has no effect

Im using the image-chooser library in my app which has the android: icon set, so I need to override this attribute for gradle for a successful build:

<?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 I get the following:

Failed to execute merge manifest: attribute app @ icon value = (@ drawable / icon) from AndroidManifest.xml: 20: 9 also present in com.kbeanie: image-chooser-library: 1.4.3: 13: 9 value = (@ drawable / ic_launcher) Suggestion: add "tools: replace =" android: icon "" to element in AndroidManifest.xml: 15: 5 to override

Any suggestions?

+3


source to share


3 answers


I had the same problem, and because it happened on multiple build machines, and when creating a test project with only the library that caused this problem, everything worked fine, I suspected some kind of error in the manifest merge.



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

+13


source


You can try adding useOldManifestMerger true

to build.gradle file (in tag android{}

) but this feature is removed from 1.0.0 version of gradle plugin.

Or add tools:replace="android:icon"

to yours AndroidManifest.xml

. ( Warning : you must add xmlns:tools="http://schemas.android.com/tools"

to the tag <manifest/>

first )



For more information on merging manifest, you can visit the White Paper .

+2


source


I checked this in my manifest, this

tools:replace="android:icon"

      

not easy "icon"

0


source







All Articles