Reputation: 13
I want to create Adapter Class that extend RecyclerView.Adapter
, so I need to add RecyclerView to gradle.
After I go to Dependencies and I search EecyclerView it shows me "com.android.support:recyclerview-v7:26.0.0-alpha1"
instead of "com.android.support:appcompat-v7:25.3.1"
what should I do, now?
and after I add "com.android.support:recyclerview-v7:26.0.0-alpha1"
, android studio message Gradle build shows me:
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:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:recyclerview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.
please help me!
Upvotes: 1
Views: 4215
Reputation: 29794
This is because you have mix version of Support Library. You need to use the same Support library version. If there is appCompat library in your module build.gradle
, change it to the same version with RecyclerView. So, it should be like this:
dependencies {
...
// NEVER USE alpha version in your production code.
compile "com.android.support:recyclerview-v7:26.1.0"
compile "com.android.support:appcompat-v7:26.1.0"
}
If you can't found the conflicted support library in your dependencies, it means you have dependencies which using Support Library implicitly. Check it from dependencies tree with the following command in your terminal in Linux:
./gradlew app:dependencies
or if you're using Windows try this in command prompt:
gradlew.bat app:dependencies
Then, after you found the conflicted Support Library, you need exclude it with:
compile('com.library.name:version') {
exclude group: 'com.android.support'
//exclude module: 'appcompat-v7'
}
Upvotes: 3