add 'tools:replace="Android:value"' to <meta-data> element at AndroidManifest
Asked Answered
W

12

69

I'm following a tutorial in HeadFirst Android development and encountered issues after adding: private ActionBarDrawerToggle drawerToggle;

The control was deprecated so I followed instructions on Stack to resolve that issue by adding com.android.support:appcompat-v7:26.0.0-alpha1 to the app modules Dependencies

But now I'm getting the following build errors:

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

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:recyclerview-v7:25.3.1] AndroidManifest.xml:24:9-31 is also present at [com.android.support:appcompat-v7: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:22:5-24:34 to override.

Here is the code:

Wallachia answered 31/3, 2017 at 11:54 Comment(2)
I added the following to my Manifest: xmlns:tools="schemas.android.com/tools"> <meta-data> tools:replace="android:value"</meta-data> then got the following error: Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple errors, see logsWallachia
add version 25.3.1 for every supportlibrary like : recyclerview-v7 ,support-v4 , design: in build.gradle as :- compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:recyclerview-v7:25.3.1' compile 'com.android.support:design:25.3.1'Admission
S
186

Problem is that all support libraries with same version and major version has to match compile SDK version.

So try to force a specific support library version. Put this at the end of your app module in 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'
            }
        }
    }
}
Sophomore answered 7/4, 2017 at 8:11 Comment(9)
This worked for me. Not sure why it is not accepted as valid answer.Laterality
Whats major version and same version mean? +1 for working solution.Perspicuity
@sagar giri I get can't resolve symbol 'DependencyResolveDetails' error for this. can you tell me the solutionCoheir
@D.hodges this is the working solution. kindly accept it as an answer.Potvaliant
Thanks, this worked. Should be accepted as valid answerSteed
this works for me as well. @sagar giri can u plz explain what this method is doing, how it is working. plz i want to know this code expalination.Vixen
thnx @sagar giriRounce
If I build with a Jenkins Pipeline, i don't have access to build.gradle, because build it in realtime execution. How I solve it?Holland
work for me! 2018-April. my project was React Native 0.51. after Android Studio update it got all kind of small problem. and I use this one, it work! (and then I upgrade from React Native 0.51 to 0.55Pentastyle
D
39

First add this line to your manifest tag if you do not have yet:

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

Example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.winanainc"
    android:versionCode="3"
    android:versionName="1.2"
    xmlns:tools="http://schemas.android.com/tools">

Then Add this meta tag inside your application to overwrite you build tools version, in this case for example I choosed the version 25.3.1

<application>
   ...
   ..
    <meta-data
        tools:replace="android:value"
        android:name="android.support.VERSION"
        android:value="25.3.1" />
</application>
Danadanae answered 5/4, 2018 at 0:3 Comment(1)
Exactly whats neededShudder
T
7
        Add <meta-data> tag in manifest.xml file as below...


    <?xml version="1.0" encoding="utf-8"?>
    <manifest package="com.demo"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools">

        <uses-permission android:name="android.permission.INTERNET"/>

        <application
            android:name=".MyApplication"
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity
                android:name=".MainActivity"
                android:theme="@style/AppTheme">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>

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

            **<meta-data
                tools:replace="android:value"
                android:name="android.support.VERSION"
                android:value="25.3.1" />//this 25.3.1 version should be same which we defined in the build.gradle file. i am using compileSdkVersion 25**

        </application>
 </manifest>

it will work @Ambilpura....

Tartarous answered 6/3, 2019 at 8:0 Comment(0)
C
6
 <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:largeHeap="true"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"

            >
            <meta-data
                tools:replace="android:value"
                android:name="android.support.VERSION"
                android:value="26.0.0" />
        </application>
Certainty answered 23/7, 2018 at 5:3 Comment(0)
A
5

Changed all support library versions 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 the following parameters to 25:

compileSdkVersion 25
targetSdkVersion 25
Assign answered 5/7, 2017 at 15:50 Comment(0)
D
3

Open Android Studio -> Open Manifest File

Add <uses-sdk tools:overrideLibrary="android.support.v17.leanback"/>. Don't forget to include xmlns:tools="http://schemas.android.com/tools" too, before the <application> tag

replace

compile 'com.android.support:recyclerview-v7:+' 

by

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

and add

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
Drainpipe answered 20/6, 2017 at 7:40 Comment(0)
E
3

I've tried all solution but nothing work. After reading google docs I have found my solution that fixed my manifest merge issue.

Just add this simple line in manifest file:

<application
      ...
      tools:node="replace"
      ...
</application>

This fixed my issue.

If this doesn't work then try with these,

tools:node="merge-only-attributes"
tools:node="removeAll"
tools:node="replace"

You can find google docs from this link. Merge multiple manifest files

Earthshine answered 14/9, 2021 at 7:32 Comment(0)
A
1
  1. At Android Studio -> Open Manifest File
  2. Switch to Merged Manifest and check Other Manifest file.

In my case I am using 26.1.0 support files but found support-v13 is 26.0.1 enter image description here

So I added implementation 'com.android.support:support-v13:26.1.0' to Gradle file and problem solved

Animalism answered 10/8, 2018 at 3:26 Comment(0)
B
0

the answer by @sagar giri is a temporary work around. what i did to solve this is explained at the end.

If you have latest support library installed in latest android studio and if you have a old support library version in build gradle's app module, then android studio fails due to the version mismatch.

So update your support library version to latest one and fix latest support library changes like icon renaming etc and rebuild it.

hope it helps...

Baulk answered 26/5, 2017 at 6:29 Comment(0)
T
0

This code resolved my problem

"Problem is that all support libraries with same version and major version has to match compile SDK version.

So try to force a specific support library version. Put this at the end of your app module in build.gradle."

thanks

Trunnel answered 5/6, 2019 at 9:50 Comment(0)
N
0

Whenever you face this issue, the best approach is to run Rebuild Project - this will tell you exactly why this is happening.

In my case it was a meta-data present in both module and app

Numerate answered 10/10, 2020 at 8:8 Comment(0)
A
-4

add 'tools:replace="android:value"' to element at AndroidManifest.xml:22:5-24:34 to override. add to Line AndroidManifest.xml:22

Anaxagoras answered 10/8, 2018 at 6:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.