Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Getting "Manifest merger failed" error after updating to a new version of gradle

Tags:

android

After accepting to update the project to new version of gradle I get this 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:cardview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38     is also present at [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).     Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:41 to override. 

How can I solve this problem? This is my app's build.gradle file:

android {     compileSdkVersion 25     buildToolsVersion "25.0.2"     defaultConfig {         applicationId "com.sample.bookReader"         minSdkVersion 16         targetSdkVersion 25         versionCode 1         versionName "1.0"     }     ... }  dependencies {     compile fileTree(include: ['*.jar'], dir: 'libs')     compile 'com.android.support:multidex:+'     compile 'com.android.support:appcompat-v7:26.0.0-alpha1'     compile 'com.android.support:cardview-v7:26.0.0-alpha1'     compile 'com.android.support:design:25+'     compile 'com.jakewharton:butterknife:8.2.1'     apt 'com.jakewharton:butterknife-compiler:8.2.1'     ... } 

And this is the project's build.gradle:

buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:2.3.1'         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'     } }  allprojects {     repositories {         jcenter()         maven { url "https://www.jitpack.io" }     } }  task clean(type: Delete) {     delete rootProject.buildDir } 

How do I fix this error while maintaining the changes made by updating the gradle version?

like image 822
tux-world Avatar asked Apr 07 '17 14:04

tux-world


People also ask

How do I fix error manifest merger failed?

The initial process would be to open the manifest application known as the AndroidManifest. xml and then click on the Merged Manifest tab below your edit pane. Following which, Click on the merged manifest option. An Error would be visible at the right column and then one must try to solve the error.

How do I fix manifest merger failed with multiple errors?

The following hack works: Add the xmlns:tools="http://schemas.android.com/tools" line in the manifest tag. Add tools:replace="android:icon,android:theme,android:allowBackup,label,name" in the application tag.

How do I find my merged manifest Android?

Inspect the merged manifest and find conflicts Even before you build your app, you can see a preview of what your merged manifest looks by opening your AndroidManifest. xml file in Android Studio, and then clicking the Merged Manifest tab at the bottom of the editor.

Where is the manifest file in Android Studio?

The file is located at WorkspaceName>/temp/<AppName>/build/luaandroid/dist. The manifest file provides essential information about your app to the Android operating system, and Google Play store. The Android manifest file helps to declare the permissions that an app must have to access data from other apps.


1 Answers

Put this at the end of your app module build.gradle:

configurations.all {     resolutionStrategy.eachDependency { DependencyResolveDetails details ->         def requested = details.requested         if (requested.group == 'com.android.support') {             if (!requested.name.startsWith("multidex")) {                 details.useVersion '25.3.0'             }         }     } } 

Credit to Eugen Pechanec

like image 130
Vishal Avatar answered Sep 30 '22 12:09

Vishal