RecyclerView creates dependencies problem

After adding the specified dependency, Android Studio spits out an error detailing how using different versions of support libraries may crash your program. I was able to fix the problem by changing in my build.gradle file:
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1’
to
compile ‘com.android.support:recyclerview-v7:25.3.1’

3 Likes

Thank you! This solved the exact problem that I was having!

Thanks…it solved the issue!

I had the same problem but since my initial project was referencing a slightly older library:
compile ‘com.android.support:appcompat-v7:25.3.0’, even after I added the suggested change of :
compile 'com.android.support:recyclerview-v7:25.3.1’
I was still receiving some strange errors which looked like:

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.0) from [com.android.support:appcompat-v7:25.3.0] AndroidManifest.xml:27:9-31
is also present at [com.android.support:recyclerview-v7:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1).
Suggestion: add ‘tools:replace=“android:value”’ to element at AndroidManifest.xml:25:5-27:34 to override.

To fix that, I obviously (after many attempts) had to change the initial appcompat library version to :
compile 'com.android.support:appcompat-v7:25.3.1

For me, v7:25.3.1 is not an available selection, only v7:26.0.0-alpha, which generates that “Manifest merger failed” error message. So, you may have to select that and then manually change the version number to equal that of the SDK version shown in compileSdkVersion or enter it manually.

this solution didn’t work for me, but led me to finding one that did. I ended up copying the build.gradle file from the sample project and pasting into my build.gradle.

Here’s the bit that made the difference
compile 'com.android.support:appcompat-v7:25.3.0’
compile ‘com.android.support:recyclerview-v7:25.3.0’