Reputation: 25
I am trying to use the ActionBarSherlock library to implement a Contextual Action Bar. I have a navigation drawer from which I navigate to another activity containing a listview. While extending my activity from ActionBarActivity, everything works fine, but when I try extending from SherlockListActivity, I get the 'java.lang.NoClassDefFoundError'.
Below is the stack trace:
08-12 17:50:03.563: E/AndroidRuntime(22395): FATAL EXCEPTION: main 08-12 17:50:03.563: E/AndroidRuntime(22395): java.lang.NoClassDefFoundError: com.example.scholar.Assignments 08-12 17:50:03.563: E/AndroidRuntime(22395): at com.example.scholar.Schedule.selectItem(Schedule.java:171) 08-12 17:50:03.563: E/AndroidRuntime(22395): at com.example.scholar.Schedule.access$0(Schedule.java:162) 08-12 17:50:03.563: E/AndroidRuntime(22395): at com.example.scholar.Schedule$DrawerListItemClickListener.onItemClick(Schedule.java:158) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.widget.AdapterView.performItemClick(AdapterView.java:298) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.widget.AbsListView.performItemClick(AbsListView.java:1114) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2933) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.widget.AbsListView$1.run(AbsListView.java:3691) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.os.Handler.handleCallback(Handler.java:615) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.os.Handler.dispatchMessage(Handler.java:92) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.os.Looper.loop(Looper.java:153) 08-12 17:50:03.563: E/AndroidRuntime(22395): at android.app.ActivityThread.main(ActivityThread.java:5086) 08-12 17:50:03.563: E/AndroidRuntime(22395): at java.lang.reflect.Method.invokeNative(Native Method) 08-12 17:50:03.563: E/AndroidRuntime(22395): at java.lang.reflect.Method.invoke(Method.java:511) 08-12 17:50:03.563: E/AndroidRuntime(22395): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 08-12 17:50:03.563: E/AndroidRuntime(22395): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 08-12 17:50:03.563: E/AndroidRuntime(22395): at dalvik.system.NativeStart.main(Native Method)
Whereas the method for navigating to the activity with the listview is:
private class DrawerListItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { selectItem(position); } }
private void selectItem(int position) {
// just trying things out and they appear to be working
switch (position) {
case 0:
Intent i = new Intent(Schedule.this, Timetable.class);
startActivity(i);
break;
case 1:
Intent assignment = new Intent(Schedule.this, Assignments.class);
startActivity(assignment);
break;
case 2:
}
/**
* Update selected item and title, then close drawer
*/
mDrawerList.setItemChecked(position, true);
setTitle(mDrawerListTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
}
Assistance will be highly appreciated
Upvotes: 1
Views: 114
Reputation: 20520
Well, it can't find the com.example.scholar.Assignments class. Is that one you've written? Does it exist in your project?
I'm pretty sure it isn't a standard class in any kind of library, because you're not really supposed to put things in com.example.
Upvotes: 1
Reputation: 4686
Check out the accepted answer here: Android java.lang.NoClassDefFoundError
It is likely the same error you are getting. Android changed where the libs are located and how they get exported in Android in version 17.
Essentially, your library needs to be in "libs" and if it is not, or can not be, it should be exported in Order and Export.
Also make sure to do a "clean" after making any changes related to order and export and moving libraries around.
Upvotes: 1