Reputation: 3488
I have updated my android SDK with Android 5.0 (API 21); I have also updated Platform tools and Build tools.
I am getting The following classes could not be found:
- android.support.v7.widget.RecyclerView (Fix Build Path, Edit XML, Create Class)
error after adding RecycleView in layout xml file.
My layout xml file looks like follows:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.androidlintro.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
can anyone tell me what's going wrong. Why I am getting this error, even after downloading complete set of software (new SDK, build tools, platform tools etc)
Note: I am using eclipse IDE
Upvotes: 4
Views: 8392
Reputation: 18899
For Android Studio:
Select: File -> Project Structure... -> Dependencies
Click the "+" in the upper right corner and choose "1 Library dependency"
Search for "com.android.support:recyclerview"
You will see the current version of the library. Slect it and click "OK"
Gradle will sync and you are ready.
Upvotes: 0
Reputation: 2284
If your problem is not solved or for future readers , here is the answer: From android sdk manager download Android Support Library first.
Go to this location and copy .aar file from here
X:\android-sdk\extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0
Then rename it as .zip file then unZIP it then find classes.jar file , rename it with some proper name like 'RecyclerView_v7.jar' Then copy the that .jar file in you project library. Add it to build path then restart eclipse so that it can be instantiated (not necessary but i had to do this).
Upvotes: 0
Reputation: 1866
Make sure the Android Support Library is included in your project.
In Eclipse: Right click on Project -> Properties -> Android
Then add the Android Support Library to the build path.
Then clean the project and build.
Upvotes: 0