Java – NoClassDefFoundError and ClassNotFoundException

NoClassDefFoundError and ClassNotFoundException… here is a solution to the problem.

NoClassDefFoundError and ClassNotFoundException

I get these errors:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/gson/stream/JsonReader;

Caused by: java.lang.ClassNotFoundException: Didn't find class "" on path: DexPathList[[zip file "/data/app/project.1stApp.youtubeplayer-1/ base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

When I try to run my app, this “” library is a jar file that I did add to my project, which I couldn’t understand when I ran into this issue.

Didn’t add code because I found it not related to the bug….


Copy the jar to your libs folder and add it to your build.gradle dependencies

compile fileTree(dir: 'libs', include: ['*.jar'])
compile ''

(Swap 2.3.1 for your JSON version, or use 2.3.*).

Don’t forget to sync

Related Problems and Solutions