7

I tried to add my own icon to my app in Android Studio and I encountered a Manifest merger fail. I fount an identical question here but his answer is not working for me. I tried adding tools:replace="android:icon" and tools:replace="android:icon,android:theme" (on 2 separate occasions of course) but no change.

This is the error Android Studio is keep giving me.

Error:(12, 9) Execution failed for task ':app:processDebugManifest'.

> Manifest merger failed : Attribute application@icon value=(@drawable/footynews_logo_new) from AndroidManifest.xml:12:9
    is also present at com.arasthel:gnavdrawer-library:1.1.4:4:45 value=(@drawable/ic_launcher)
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:9:5 to override
Error:(12, 9) Attribute application@icon value=(@drawable/footynews_logo_new) from AndroidManifest.xml:12:9

EDIT : I just found out even though I thought the app was using the ic_launcher in my project directory, it is actually using the ic_launcher in one of the libraries I'm using. How do I force the app to use my launcher icon instead?

Community
  • 1
  • 1
Thahzan
  • 975
  • 2
  • 9
  • 23
  • Possible duplicate of [Android studio Gradle icon error, Manifest Merger](http://stackoverflow.com/questions/24506800/android-studio-gradle-icon-error-manifest-merger) – Jaiprakash Soni Oct 16 '15 at 09:17

2 Answers2

19
tools:replace="android:icon,android:theme"

should work. Hope you added

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

If this is not working you have another option. Use the old manifest merger. Add this in your build.gradle file

android { useOldManifestMerger true }

You can find more information here.

Kushal Sharma
  • 5,978
  • 5
  • 25
  • 41
San
  • 5,567
  • 2
  • 26
  • 28
  • I did add xmlns:tools="http://schemas.android.com/tools. It turns out a library I used (GNavDrawer) had a Manifest and somehow, my project was forced to use its ic_launcher (or I think it is). I resolved this issue by changing that manifest file (although I'm not sure if it's the correct way to do it) – Thahzan Jul 17 '14 at 08:21
  • 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:54
5

Add two line in manifest file :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="..."
    xmlns:tools="http://schemas.android.com/tools"> <!--Add this line-->

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        tools:replace="icon, label"/> <!--Add this line-->
</manifest>
Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98