Manifest Merger failed with multiple errors in Android Studio

I was also facing same issues, and after lot of research found the solution:

  1. Your min sdk version should be same as of the modules you are using eg: your module min sdk version is 14 and your app min sdk version is 9 It should be same.
  2. If build version of your app and modules not same. Again it should same ** In short, your app build.gradle file and manifest should have same configurations**
  3. There's no duplicacy like same permissions added in manifest file twice, same activity mention twice.
  4. If you have delete any activity from your project, delete it from your manifest file as well.
  5. Sometimes its because of label, icon etc tag of manifest file:

a) Add the xmlns:tools line in the manifest tag.

b) Add tools:replace= or tools:ignore= in the application tag.

Example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.slinfy.ikharelimiteduk"
    xmlns:tools="http://schemas.android.com/tools"
    android:versionCode="1"
    android:versionName="1.0" >

  <application
      tools:replace="icon, label"
      android:label="myApp"
      android:name="com.example.MyApplication"
      android:allowBackup="true"
      android:hardwareAccelerated="false"
      android:icon="@drawable/ic_launcher"
      android:theme="@style/Theme.AppCompat" >
  </application>

</manifest>
  1. If two dependencies are of not same version example: you are using dependency for appcompat v7:26.0.0 and for facebook com.facebook.android:facebook-android-sdk:[4,5) facebook uses cardview of version com.android.support:cardview-v7:25.3.1 and appcompat v7:26.0.0 uses cardview of version v7:26.0.0, So there is discripancy in two libraries and thus give error

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 is also present at [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:41 to override.

So by using appcompat of version 25.3.1, We can avoid this error

By considering above points in mind, you will get rid of this irritating issue. You can check my blog too https://wordpress.com/post/dhingrakimmi.wordpress.com/23


For me THIS works -

Finding Merging Errors in AndroidManifest.xml

enter image description here

Click on Merged Manifest in AndroidManifest.xml

enter image description here

You can view manifest merging error in right column. It may help to solve this problem.


Remove <activity android:name=".MainActivity"/> from your mainfest file. As you have already defined it as:

 <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

So, Manifest file showing ambiguity.


Open application manifest (AndroidManifest.xml) and click on Merged Manifest tab on bottom of your edit pane. Check the image below:

enter image description here

From image you can see Error in the right column, try to solve the error. It may help some one with the same problem. Read more here.

Also, once you found the error and if you get that error from external library that you are using, You have to let compiler to ignore the attribute from the external library. //add this attribute in application tag in the manifest

   tools:replace="android:allowBackup" 
                                                                                                                                          
   //Add this in the manifest tag at the top

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

Tags:

Xml

Android