I keep getting the classnotfoundexception when trying to run my project on an emulator. I have looked around on here before posting this question, I have tried adding libraries to the build path, cleaning / building the project but still hasn't solved the issue.
The project was built from using an open source calendar project. So the name is weird, but doesn't have any affect on the build.
Here's the LogCat:
09-03 12:37:36.990: E/Trace(2272): error opening trace file: No such file or directory (2)
09-03 12:37:37.439: W/dalvikvm(2272): Unable to resolve superclass of Lcom/squareup/timessquare/sample/DashboardActivity; (453)
09-03 12:37:37.482: W/dalvikvm(2272): Link of class 'Lcom/squareup/timessquare/sample/DashboardActivity;' failed
09-03 12:37:37.482: D/AndroidRuntime(2272): Shutting down VM
09-03 12:37:37.482: W/dalvikvm(2272): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
09-03 12:37:37.540: E/AndroidRuntime(2272): FATAL EXCEPTION: main
09-03 12:37:37.540: E/AndroidRuntime(2272): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.squareup.timessquare.sample/com.squareup.timessquare.sample.DashboardActivity}: java.lang.ClassNotFoundException: com.squareup.timessquare.sample.DashboardActivity
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.os.Handler.dispatchMessage(Handler.java:99)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.os.Looper.loop(Looper.java:137)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-03 12:37:37.540: E/AndroidRuntime(2272): at java.lang.reflect.Method.invokeNative(Native Method)
09-03 12:37:37.540: E/AndroidRuntime(2272): at java.lang.reflect.Method.invoke(Method.java:511)
09-03 12:37:37.540: E/AndroidRuntime(2272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-03 12:37:37.540: E/AndroidRuntime(2272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-03 12:37:37.540: E/AndroidRuntime(2272): at dalvik.system.NativeStart.main(Native Method)
09-03 12:37:37.540: E/AndroidRuntime(2272): Caused by: java.lang.ClassNotFoundException: com.squareup.timessquare.sample.DashboardActivity
09-03 12:37:37.540: E/AndroidRuntime(2272): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-03 12:37:37.540: E/AndroidRuntime(2272): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-03 12:37:37.540: E/AndroidRuntime(2272): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-03 12:37:37.540: E/AndroidRuntime(2272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
And here's the class declared in the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.squareup.timessquare.sample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="17" />
<application
android:label="@string/app_name"
android:icon="@drawable/supporticon"
android:debuggable="true"
android:supportsRtl="true">
<activity
android:name=".DashboardActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize|keyboardHidden"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Here's the class content:
public class DashboardActivity extends SherlockFragmentActivity {
ActionBar mActionBar;
ViewPager mPager;
Tab tab;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard);
// Activate the navigation mode tabs
mActionBar = getSupportActionBar();
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Locate the view pager in dashboard.xml
mPager = (ViewPager) findViewById(R.id.pager);
// Activate the fragment manager
FragmentManager fm = getSupportFragmentManager();
// Capture view pager swipes
ViewPager.SimpleOnPageChangeListener ViewPagerListener = new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
// Find the view pager position
mActionBar.setSelectedNavigationItem(position);
}
};
mPager.setOnPageChangeListener(ViewPagerListener);
// Locate the adapter class
ViewPagerAdapter viewpageradapter = new ViewPagerAdapter(fm);
// Set the view pager adapter in ViewPager
mPager.setAdapter(viewpageradapter);
// Capture the button clicks
ActionBar.TabListener tabListener = new ActionBar.TabListener() {
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
// Pass the position on tab click to view pager
mPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
};
// Create the first tab
tab = mActionBar.newTab().setText("Support Tab")
.setTabListener(tabListener);
mActionBar.addTab(tab);
// Create the second tab
tab = mActionBar.newTab().setText("Students Tab")
.setTabListener(tabListener);
mActionBar.addTab(tab);
}
}
The only issues I can think of is that when I right click on my project > project properties > Android the actionbarsherlock reference has a red cross beside it. Even though there are no errors in my classes where I've used the library, I'm not sure if this has anything to do with it.
Any help would be appreciated, thanks.