Android: "Manifest Merge Error" error after upgrading to a new version of gradle

After confirming the upgrade of the project to the 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 the file of my build.gradle application:

 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 build.gradle project:

 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 to fix this error while saving changes made by updating Gradle version?

+96
android
Apr 7 '17 at 14:37 on
source share
13 answers

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

 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' } } } } 
+184
Jul 11 '17 at 4:46 on
source share
— -

You are using several versions of the Android support libraries:

 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+' 

Two are 26.0.0-alpha1 , and one uses 25+ .

Select one specific version and use it for all three. Since your compileSdkVersion not O , use 25.3.1 for all three of these libraries, resulting in:

 compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:cardview-v7:25.3.1' compile 'com.android.support:design:25.3.1' 
+84
Apr 07 '17 at 14:49
source share

I changed all versions of the supporting libraries to 25.3.1 and worked like a charm:

 compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:25.3.1' 

You also need to change compileSdkVersion and targetSdkVersion to 25:

 compileSdkVersion 25 targetSdkVersion 25 
+14
Jul 05 '17 at 15:57
source share

You can find out which library depends on the wrong version of the support library and exclude it as follows:

 compile ('com.stripe:stripe-android:5.1.1') { exclude group: 'com.android.support' } 

stripe-android in my case.

+8
Dec 06 '17 at 20:54 on
source share

I do not use different versions of libraries and got the same error, this happened after removing buildToolsVersion in AS RC 1, but adding tools:node="replace" did the trick, just add this to your manifest. xml inside <application ..../> block:

 <meta-data tools:node="replace" android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 
+6
Oct 21 '17 at 16:12
source share

This is the same for me. See Gradle -> Build Gradle -> and make sure that the compatibility is the same in both the app compat and design design compilation lists, they must have the same version.

Then, to be sure that it will start without any problems, go to the "File → Project Structure →" menu and check the "Assembly Properties" tab, it should be the same as your support compilation line, only in case I set the target version of the SDK as 25 on the Flavors tab.

 dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) *compile 'com.android.support:appcompat-v7:25.3.1'* compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' *compile 'com.android.support:design:25.3.1'* } 

Here is what I did and worked. Good luck

+5
Oct 19 '17 at 0:58
source share
  • Update your support library to the latest version.

  • Open the Manifest File and add it to the manifest file

  • <uses-sdk tools:overrideLibrary="android.support.v17.leanback"/>

  • And add for recyclerview in >> build.gradle Module app :

  • compile 'com.android.support:recyclerview-v7:25.3.1'

  • And click: Sync Now

+3
Jun 29 '17 at 1:08 on
source share

The answer is accepted, but one thing you can do as well is to identify libraries from your project structure. What you can do is:

  • Comment on all libraries in which there is a problem.
  • Go to the structure of your project
  • Add the libraries there and it will automatically sync and the problem will disappear.
  • If the problem persists, try to find from the error log which library it requires after completing all the above three steps.

What happens with the predefined libraries as of now, now I take appomppat: 26.0.0-alpha1 , it uses an older version of what adds something new and tries to resolve it with old things. When you add it from your project structure, it will add the same, but with new products, to allow it. Your problem will be resolved.

+2
Aug 03 '17 at 9:22 on
source share

I solve this by putting this at the end of my build.gradle application module:

  configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '26.0.0' } } } } 
+2
Dec 25 '18 at 10:10
source share

The error for me was:

 Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:percent:26.0.2] AndroidManifest.xml:25:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override. 

The solution for me was in my Gradle file of the project that I need to raise my version of com.google.gms: google-services.

I used version 3.1.1:

 classpath 'com.google.gms:google-services:3.1.1 

And the error was fixed after I raised it to version 3.2.1:

 classpath 'com.google.gms:google-services:3.2.1 

I just updated all my libraries to the latest version, including v27.1.1 of all support libraries and v15.0.0 of all Firebase libraries, when I saw an error.

0
Apr 28 '18 at 3:52
source share

I updated my old Android project for Wear OS. I received this error message when building the project:

 Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:percent:26.0.2] AndroidManifest.xml:25:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override. 

The build.gradle for Wear app contains the following dependencies:

 dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.google.android.support:wearable:2.4.0' implementation 'com.google.android.gms:play-services-wearable:16.0.1' compileOnly 'com.google.android.wearable:wearable:2.4.0'} 

SOLUTION :

Adding implementation 'com.android.support:support-v4:28.0.0' depending on my problem.

0
Jan 02 '19 at 14:46
source share

Try deleting the metadata and rebuilding the project.

0
Jan 25 '19 at 12:53 on
source share

try to read the link

Error: execution completed for task ': app: processDevDebugManifest. Manifest merge failed: attribute meta-data#android.support.VERSION@value value = (25.3.0) and then usd VERSION 26.0.0

: https://medium.com/@PongPloyAppDev/error-execution-failed-for-task-app-processdevdebugmanifest-48576be751

enter image description here

-four
Oct 14 '17 at 17:48 on
source share



All Articles