Show me an error with the Manifest

1

I have this error in android studio

  

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:recyclerview-v7:26.0.0-alpha1] AndroidManifest.xml: 24: 9 -38 is also present at [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml: 27: 9-31 value = (25.3.1). Suggestion: add 'tools: replace="android: value"' to element at AndroidManifest.xml: 22: 5-24: 41 to override.

This is my gradle app

This I add it to

noinspection GradleCompatible
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:recyclerview-v7:+'

At manifest I have not changed anything, I hope you can tell me how to solve it and what is the logic to not have this problem in the future. Thanks.

    
asked by Luis Carlos Gallegos 02.12.2017 в 21:23
source

2 answers

1

Some libraries depend on the "X or later" version (be careful with the use of adding .x because it can cause problems with your code as updates ) of the Android support libraries, so the dependency resolution of Gradle takes whatever is new, ignoring that it really has an accurate version specified in its dependencies

All support libraries must have the same version and the main version must match the build version of the SDK.

Put this at the end of your application module 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'
            }
        }
    }
}

"With this you can force to use a specific version". Of course, replace the version you are using.

For more information and if you have questions, check the documentation . of the well-documented method.

    
answered by 02.12.2017 в 23:34
-1

In this case you are defining different versions of the android libraries which is not recommended, I suggest using the same versions.

Regarding the main problem, it is because you are defining the dependency:

  

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

By specifying the "+" sign you are actually taking the library

  

com.android.support:recyclerview-v7:26.0.0-alpha1

This library of the RecyclerView is an old version, in fact it seems to me it was the first "alpha" version.

To solve the problem define similar versions of your support libraries for example if you are defining a targetSdkVersion 25 , define:

'com.android.support:design:25.3.1'
'com.android.support:recyclerview-v7:25.3.1'
'com.android.support:appcompat-v7:25.3.1'
    
answered by 03.12.2017 в 09:07