Reputation: 6913
I am getting an error with the new version of SherlockActionBar. When I was running from the snapshot there was no problem. Updated to 4.0, it now throws a NoClassDefFoundError. I am compiling against Android 4.0, pulling the library down from the maven repo.
Here is the offending code:
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.Tab tab = getSupportActionBar().newTab();
tab.setText("Today");
tab.setTabListener(this);
tab.setCustomView(new DatePairView(this, new DateTime()));
getSupportActionBar().addTab(tab);
Here is the logcat output:
03-08 20:35:05.633: ERROR/AndroidRuntime(10976): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.actionbarsherlock.app.SherlockFragmentActivity
at com.actionbarsherlock.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:509)
at com.actionbarsherlock.internal.app.ActionBarImpl.addTab(ActionBarImpl.java:452)
at com.actionbarsherlock.internal.app.ActionBarImpl.addTab(ActionBarImpl.java:438)
at com.kopysoft.chronos.activities.ClockActivity.onCreate(ClockActivity.java:88)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
03-08 20:35:05.633: WARN/ActivityManager(96): Force finishing activity com.kopysoft.chronos/.activities.ClockActivity
03-08 20:35:06.133: WARN/ActivityManager(96): Activity pause timeout for HistoryRecord{407fef58 com.kopysoft.chronos/.activities.ClockActivity}
03-08 20:35:16.303: WARN/ActivityManager(96): Activity destroy timeout for HistoryRecord{407fef58 com.kopysoft.chronos/.activities.ClockActivity}
The full code can be found here: https://github.com/kopysoft/Chronos/blob/6ff2692042ca542f67984fda2759744f4746b788/ChronosApp/src/com/kopysoft/chronos/activities/ClockActivity.java
Thanks for all the help!
Edit 1 Updated reference the a static entry in git vs the most up to-date-one.
Upvotes: 0
Views: 1677
Reputation: 308743
That exception usually means that you're missing a JAR in your CLASSPATH. The fact that it runs in one context might be lulling you to sleep, thinking that you're doing everything correctly, but you'll get to a solution faster if you believe what the compiler is telling you.
Find the JAR that houses that class and figure out how to get it into the CLASSPATH. Repeat until the errors go away.
Upvotes: 1