Home » Android » android – RecyclerView ClassNotFound

android – RecyclerView ClassNotFound

Posted by: admin April 23, 2020 Leave a comment


I tried to add RecyclerView and CardView into my project

dependencies {
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v13:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.viewpagerindicator:library:[email protected]'
compile project(':facebook')

it compiles, but I got below exception when run it on device

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.RecyclerView" on path: DexPathList[[zip file "/data/app/xxxx.apk"],nativeLibraryDirectories=[/data/app-lib/xxxx, /vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
        at android.view.LayoutInflater.createView(LayoutInflater.java:559)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
How to&Answers:

Problem in your layout. Change




If you create RecyclerView programmatically – make sure you have proper import:

import android.support.v7.widget.RecyclerView;


I did all what have been said in this post but nothing worked.

What did work for me:

1.Add this as say up in your build.gradle:

compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'

2.Add the RecyclerView as a standar View and indicate the class:


3.Then add the imports:

import android.support.v7.widget.RecyclerView;

Hope this helps!


If you are updated your android studio to v-3.4.2

then Change from




it’s work for me.


If you’re looking for solution in 2019, you could try to change android.support.v7.widget.RecyclerView for androidx.recyclerview.widget.RecyclerView. It works for me. Hope it helps!


This worked for me:

compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'

Best regards!


in eclipse, you need to clear other(older) versions of android-support-v4.jar from other libraries which you import directly or indirectly.

for my instance ; my project(TurkRenkleri) includes MobilePlayGround which includes appcompat library(which has a older version of support v4 jar). So i didnt get the error given below, instead i got RecyclerView ClassNotFound.

after doing this , i finally got the error below, and understood problem therefore the solution(delete old jars).

[2015-04-29 00:59:53 - TurkRenkleri] Found 2 versions of android-support-v4.jar in the dependency list,
 [2015-04-29 00:59:53 - TurkRenkleri] but not all the versions are identical (check is based on SHA-1 only at this time).
 [2015-04-29 00:59:53 - TurkRenkleri] All versions of the libraries must be the same at this time.
 [2015-04-29 00:59:53 - TurkRenkleri] Versions found are:
 [2015-04-29 00:59:53 - TurkRenkleri] Path: E:\calisma alani\oyunlar\android-support-v7-appcompat\libs\android-support-v4.jar
 [2015-04-29 00:59:53 - TurkRenkleri]   Length: 621451
 [2015-04-29 00:59:53 - TurkRenkleri]   SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4
 [2015-04-29 00:59:53 - TurkRenkleri] Path: E:\calisma alani\oyunlar\RecyclerView\libs\android-support-v4.jar
 [2015-04-29 00:59:53 - TurkRenkleri]   Length: 1157388
 [2015-04-29 00:59:53 - TurkRenkleri]   SHA-1: 605c447c20ca216b5556af9f215af5d4bba1b117
 [2015-04-29 00:59:53 - TurkRenkleri] Jar mismatch! Fix your dependencies


Make sure is compile ‘com.android.support:recyclerview-v7:22.2.0’


This worked for me. Add this to app gradle

compile 'com.android.support:design:23.1.1'

Then in your layout

    android:layout_alignParentStart="true" />

and in your activity

import android.support.v7.widget.RecyclerView;

and inside your onCreate

RecyclerView recyclerView;


It is a Building problem…

Yes in few cases , The code was working previously and suddenly it
stopped working (crash at app startup) when I synced and built an
older version of the code.

The fix was to just close and restart Eclipse and clean the project
and clean all the dependent library projects. Then it started working
properly again.

It’s some sort of build problem in Eclipse, when refreshing the
project files.

Update: In particular, if you’ve accidentally modified the
“.classpath” file (to revert to an older version), Eclipse/Android SDK
can get confused and not build the project properly. When you restart
Eclipse and clean the project, Eclipse will re-modify the “.classpath”
file, and build properly.