add 'tools:replace=“Android:value”' to element at AndroidManifest

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



add 'tools:replace=“Android:value”' to <meta-data> element at AndroidManifest



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:





I added the following to my Manifest: xmlns:tools="schemas.android.com/tools"&gt; <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 logs
– D.Hodges
Mar 31 '17 at 13:25






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'
– Ashish Garg
May 26 '17 at 11:53




8 Answers
8



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.


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'








This worked for me. Not sure why it is not accepted as valid answer.
– Mohammad Adnan
Apr 8 '17 at 5:40





worked for me too.
– abhishek
Jun 5 '17 at 5:03





Whats major version and same version mean? +1 for working solution.
– Talha
Jun 20 '17 at 6:16






worked for me as well. this is the correct answer.
– Rakesh Yadav
Jul 11 '17 at 5:46





@sagar giri I get can't resolve symbol 'DependencyResolveDetails' error for this. can you tell me the solution
– Nikhil
Jul 27 '17 at 7:05



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>



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



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


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


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


<application>



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'



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...


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



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


implementation 'com.android.support:support-v13:26.1.0'



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






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard