3

A conflict on Android Support library versions 25.3.1 and 26.0.0-alpha1 is causing a manifest merger failed error when performing a Gradle sync.

How can we use a tag with tools:replace property as Android Studio / gradle suggests to fix this error?

(i.e. what is the exact syntax within AndroidManifest.xml to force usage of support:design:25.3.1 instead of 26.0.0-alpha1 which an included library is using)

This is the error Gradle is producing:

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:support-v4:26.0.0-alpha1] AndroidManifest.xml:27: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:25:5-27:41 to override.
Baker
  • 24,730
  • 11
  • 100
  • 106

2 Answers2

9

Add the following to your build.gradle "app level", just after you dependencies:

configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
Vincent H Guyo
  • 356
  • 6
  • 24
  • Thanks, I already have that solution and it works, but I'm trying to learn how to correct this problem within AndroidManifest. – Baker Apr 21 '17 at 20:08
  • @Baker i think i am having the same problem, i import [reCaptcha] (https://github.com/ayltai/Android-Lib-reCAPTCHA) and i have `compile 'com.android.support:appcompat-v7:25.3.1'` on dependence. my won't complie with `Error: Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.` – niczm25 May 09 '17 at 05:46
0

In your app:gradle file, replace

'com.android.support:design:25.3.1' 

with

'com.android.support:design:26.+'
coder
  • 8,346
  • 16
  • 39
  • 53