title: NoClassDefFound Exception when trying to use custom external widget
body: <p>I am trying to implement Caldroid (<a href="https://github.com/roomorama/Caldroid" rel="nofollow">https://github.com/roomorama/Caldroid</a>) in my own project. I looked at the sample app given and it had the app separate from the project that defined the widget. I have done the same thing. The code compiles, but when I try to run the app I am getting a NoClassDefFound exception when trying to call the widget. Here is the code for setting up the calendar</p>
  
  <pre><code>private void calendarSetup(Bundle savedInstanceState) {
      caldroidFragment = new CaldroidFragment();
      if (savedInstanceState != null) {
          caldroidFragment.restoreStatesFromKey(savedInstanceState,
                  "CALDROID_SAVED_STATE");
      }
      // If activity is created from fresh
      else {
          Bundle args = new Bundle();
          Calendar cal = Calendar.getInstance();
          args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
          args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
          args.putBoolean(CaldroidFragment.ENABLE_SWIPE, true);
          args.putBoolean(CaldroidFragment.SIX_WEEKS_IN_CALENDAR, true);
  
          caldroidFragment.setArguments(args);
      }
  
      // Attach to the activity
      FragmentTransaction t = getActivity().getSupportFragmentManager()
              .beginTransaction();
      t.replace(R.id.calendar, caldroidFragment);
      t.commit();
  
  }
  </code></pre>
  
  <p>Here is the logcat</p>
  
  <pre><code>07-13 17:24:30.254: E/AndroidRuntime(2563): FATAL EXCEPTION: main
  07-13 17:24:30.254: E/AndroidRuntime(2563): Process: com.example.app, PID: 2563
  07-13 17:24:30.254: E/AndroidRuntime(2563): java.lang.NoClassDefFoundError: com.roomorama.caldroid.CaldroidFragment
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at com.example.app.fragments.MyActivity.calendarSetup(app.java:123)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at com.example.app.fragments.MyActivity.onCreateView(app.java:68)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.Activity.performStart(Activity.java:5241)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.os.Handler.dispatchMessage(Handler.java:102)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.os.Looper.loop(Looper.java:136)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at java.lang.reflect.Method.invoke(Method.java:515)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  07-13 17:24:30.254: E/AndroidRuntime(2563):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>The line at which the error is occurring is when I try to instantiate a CaldroidFragment.</p>
  
  <p>I have added the external project to the build path of this current one as has been mentioned in other SO answers. However this doesn't seem to work.</p>
  
  <p>Thanks.</p>