Search code examples
javaandroidandroid-studio-2.0

Android java.lang.NoClassDefFoundError for class in my project


I am getting below error on initializing the NavigationDrawerRecyclerViewAdapter.

Now class com.mypackage.app.NavigationDrawerRecyclerViewAdapter exists and it is public and its constructor is public as well.

1: thread exiting with uncaught exception (group=0x416fed58)
05-18 10:46:20.573 3669-3669/com.mypackage.app E/AndroidRuntime: FATAL EXCEPTION: main Process: com.mypackage.app, PID: 3669
java.lang.NoClassDefFoundError: com.mypackage.app.NavigationDrawerRecyclerViewAdapter                                                                       at com.mypackage.app.FragmentDrawer.onCreateView(FragmentDrawer.java:68)

clean and rebuild project doesn't work. Any suggestions around what could be the problem here?


Solution

  • I found the answer.

    I had multidex enabled and that was causing the problem. I was using compile 'com.google.android.gms:play-services:8.4.0' in my build.gradle while I needed only com.google.android.gms:play-services-auth:8.4.0.

    Changing the above , I was able to run my application without enabling multidex which was causing class not found error.

    This helped: App not launching with multidexEnabled true in android studio - Famous 65k reference method