0

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?

Termininja
  • 6,620
  • 12
  • 48
  • 49

3 Answers3

0

Click on your project -> Properties -> Build Path -> Order and Export Tab. Make sure that "Android Private Libraries" is checked for Export. If libraries are already adde from the libs/ folder, remove them as they are automatically added in the "Android Private Libraries" section.

Pinks
  • 958
  • 7
  • 10
0

NoClassDefFoundError indicates that class was present during the time of compilation but not available when you run your application, sometimes error on static initializer block can also result in NoClassDefFoundError or context of this class not accessible. So, make sure this class refers same class memory.

Dinesh Thalke
  • 176
  • 1
  • 3
0

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

Community
  • 1
  • 1