Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

like image 576
D.Hodges Avatar asked Mar 31 '17 11:03

D.Hodges


People also ask

How do I change AndroidManifest XML?

Open your Android project and go to <AppProjectFolder>/app/src/main/. Open the app manifest file AndroidManifest. xml and add the following lines to the file as child elements of the <manifest> element. Note: You must include the QUERY_ALL_PACKAGES permission if your app targets Android 11 (API Level 30) or higher.

What is Android name in AndroidManifest XML?

android:name is "An optional name of a class implementing the overall android. app. Application for this package. [string]".

What is AndroidManifest XML used for in Android?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is manifestPlaceholders?

If you need to insert variables into your AndroidManifest.xml file that are defined in your build.gradle file, you can do so with the manifestPlaceholders property. This property takes a map of key-value pairs, as shown here: android { manifestPlaceholders = [hostName:"www.example.com"] }


1 Answers

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'             }         }     } } 
like image 183
Sagar Giri Avatar answered Sep 21 '22 18:09

Sagar Giri