Reputation: 25143
I want to use RecyclerView in my Android app. Following are the properties:
minSdkVersion="14" (ICS)
compile sdk version="21" (L)
Target sdk version="14" (ICS)
I added compile 'com.android.support:appcompat-v7:21.0.3'
under dependencies in build.gradle file.
When I'm adding RecyclerView in XML, I'm getting following error:
The following classes could not be found:
- android.support.v7.widget.RecyclerView (Fix Build Path, Create Class)
XML code:
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
I want the application to run on all devices above ICS. Please help me in resolving this issue.
Upvotes: 3
Views: 2140
Reputation: 6017
For targetSdkVersion 25/compileSdkVersion 25
and compile 'com.android.support:appcompat-v7:25.3.1'
you need to use compile 'com.android.support:recyclerview-v7:25.3.1'
Versions needs to be same.
Upvotes: 0
Reputation: 826
Add the RecyclerView
v7 support library to your build.gradle
. There are multiple v7 libraries, each for specific features.
compile 'com.android.support:recyclerview-v7:21.0.3'
Upvotes: 3
Reputation: 14700
RecyclerView is in its own library:
compile 'com.android.support:recyclerview-v7:21.0.3'
Upvotes: 0