Reputation: 501
I want to include recyclerview in my application , I've updated the whole sdk . The android support repository is version 17 ,android support library is version 23 . I've recyclerview folder in sdk\extras\android\support\v7 directory .
For adding the library , I've put these in dependencies :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0.+'
}
when I rebuild the project ,it shows me this error :
Error:(24, 13) Failed to resolve: com.android.support:recyclerview-v7:21.0.0.+ <a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
What version of recyclerview should I use in dependencies ? How to know it?
EDIT I solve the last problem with the help of a friend , this is the new gradle :
dependencies {
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
}
Now I get this error :
F:\AndroidStudioProjects\recycleView\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v17\values-v17.xml
Error:(6, 21) No resource found that matches the given name: attr 'android:textAlignment'.
Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'...............
How to solve this one ?
Upvotes: 2
Views: 3923
Reputation: 364654
You have this issue becuase
compile 'com.android.support:recyclerview-v7:21.0.0.+'
is wrong.
You can use
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:recyclerview-v7:+'
But you can't use
compile 'com.android.support:recyclerview-v7:21.0.0.+'
Of course I suggest you using the last support library, currently the 23.1.0
compile 'com.android.support:recyclerview-v7:23.1.0'
Pay attention. This requires to compile with API 23.
Also I suggest you avoiding the +. It is not a good choice because in this way you can't replicate your build in the future.
Upvotes: 4
Reputation: 678
Better to use the latest dependency supported by android to get the latest feature and fixes provided by Android. To add a dependency follow the steps mentioned below :
Right click on your app module in project explorer.
Select "Module Settings" from the option menu.
Click on the "Dependency" tab.
Click the "+" or "-" button to add or remove dependency.
Click on + and search for dependency by giving it's name and click on the appropriate dependency.
This way you will get the latest dependecy supported by android.
Upvotes: 2
Reputation: 8211
use 23.0.0
compile 'com.android.support:recyclerview-v7:23.0.0'
Upvotes: 0