title: noClassDefFound error on ftp client: org.apache.commons.net.ftp.FTPClient
body: <p>I am working on an app that sends files to a url database. I am starting with just trying to send a picture. Currently I am getting a noclassDefFound error in my java. I have tried updating java, deleting and adding the jar files again, and I double checked my manifest for the proper permissions so I am coming here for help. I am posting the LogCat but I narrowed the problem to two lines of code: 24 in the FTP class and 82 in the uploadmedia class. I am also including the classes in question and my manifest.</p>
  
  <p>LogCat</p>
  
  <pre><code>    10-04 11:33:36.028: E/AndroidRuntime(5013): FATAL EXCEPTION: main
  10-04 11:33:36.028: E/AndroidRuntime(5013): java.lang.NoClassDefFoundError: org.apache.commons.net.ftp.FTPClient
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at com.cameratest.UploadFTP.FTPUpload(UploadFTP.java:23)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at com.cameratest.UploadMedia.onActivityResult(UploadMedia.java:80)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.app.Activity.dispatchActivityResult(Activity.java:5192)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3137)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3184)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.app.ActivityThread.access$1100(ActivityThread.java:130)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.os.Handler.dispatchMessage(Handler.java:99)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.os.Looper.loop(Looper.java:137)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at android.app.ActivityThread.main(ActivityThread.java:4745)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at java.lang.reflect.Method.invokeNative(Native Method)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at java.lang.reflect.Method.invoke(Method.java:511)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  10-04 11:33:36.028: E/AndroidRuntime(5013):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Manifest</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.cameratest"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="15" /&gt;
  
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;
      &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
      &lt;uses-permission android:name="android.permission.RECORD_VIDEO" /&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  
      &lt;uses-feature android:name="android.hardware.camera" /&gt;
      &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".Main"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="sate2012.avatar.android.UploadMedia"
              android:label="@string/app_name"
              android:screenOrientation="landscape" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="sate2012.avatar.android.MailSenderActivity"
              android:label="Upload Data Point" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAILSENDERACTIVITY" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="sate2012.avatar.android.GMailSender"
              android:label="@string/title_mail_sender_activity"
              android:screenOrientation="landscape" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="sate2012.avatar.android.GMAILSENDER" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="sate2012.avatar.android.UploadData"
              android:label="UploadData" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="sate2012.avatar.android.UPLOADDATA" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".UploadMedia"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.UPLOAD_MEDIA" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Photographer"
              android:label="photoclass" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.PHOTOGRAPHER" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".UploadFTP"
              android:label="photoclass" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.UPLOAD_FTP" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>FTP class</p>
  
  <pre><code>package com.cameratest;
  
  import android.os.Bundle;
  import android.os.Handler;
  import android.app.Activity;
  import android.content.Context;
  import java.io.IOException;
  import java.io.BufferedInputStream;
  import java.io.FileInputStream;
  import java.net.InetAddress;
  import org.apache.commons.net.ftp.FTPClient;
  
  
  public class UploadFTP extends Activity {
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      public static String FTPUpload(String filepath, String extension, Context thisContext) {
          FTPClient ftpClient = new FTPClient();
          long time = (System.currentTimeMillis());
          String filename = "T" + time;
          try {
              ftpClient.connect(InetAddress.getByName("24.123.68.146"));
              ftpClient.login("opensim", "widdlyscuds");
              ftpClient.changeWorkingDirectory("../../var/www/avatar/Uploaded");
              if (ftpClient.getReplyString().contains("250")) {
                  Handler progressHandler = new Handler();
                  ftpClient.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
                  BufferedInputStream buffIn = null;
                  buffIn = new BufferedInputStream(new FileInputStream(filepath));
                  ftpClient.enterLocalPassiveMode();
                  ProgressInputStream progressInput = new ProgressInputStream(buffIn, progressHandler);
                  ftpClient.storeFile(filename + extension, progressInput);
                  buffIn.close();
                  ftpClient.logout();
                  ftpClient.disconnect();
              }
          } catch (IOException e) {
          }
          return filename + extension;
      }
  }
  </code></pre>
  
  <p>upload media: calls ftp class</p>
  
  <pre><code>package com.cameratest;
  
  
  import java.io.File;
  
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.ActivityInfo;
  import android.os.Bundle;
  import android.os.Environment;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.ImageButton;
  
  /**
   * The Upload Menu Allows the user to select different media types to upload to
   * the server
   */
  public class UploadMedia extends Activity implements OnClickListener {
      private File sd;
      private File storageFolder;
      private File mediaFolder;
      private ImageButton pictureB;
      private String dataType;
      private String media_filepath;
      private String media_filename;
      private String media_extension;
      private static String image_filepath;
      public static Context thisContext;
  
      /**
       * Called when the activity is first created.
       */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          thisContext = getApplicationContext();
          setContentView(R.layout.upload_menu);
          setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
          createStorageDirectory();
          pictureB = (ImageButton) findViewById(R.id.cameraButton);
          pictureB.setOnClickListener(this);
  
      }
  
      /**
       * Responds to whatever button is pressed
       * 
       * @param View
       *            v - the button clicked
       */
      public void onClick(View v) {
          Intent i;
          switch (v.getId()) {
          case (R.id.cameraButton):
              dataType = getResources().getString(R.string.type_picture);
              i = new Intent(UploadMedia.this, Photographer.class);
              startActivityForResult(i, Globals.CAMERA_REQUEST);
              break;
          }
      }
  
      public void onBackPressed() {
          finish();
      }
  
      /**
       * Called when the individual activities (picture, video, audio) finish.
       */
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          // super.onActivityResult(requestCode, resultCode, data);
          if (resultCode == Activity.RESULT_OK) {
  
              if (requestCode == Globals.CAMERA_REQUEST) {
                  media_filepath = getImage_filepath();
                  media_extension = "_P.png";
              }
              media_filename = UploadFTP.FTPUpload(media_filepath,
                      media_extension, thisContext);
              Intent MailIntent = new Intent(getApplicationContext(),
                      MailSenderActivity.class);
              MailIntent.putExtra("Type", dataType);
              MailIntent.putExtra("Filename", media_filename);
              startActivity(MailIntent);
              finish();
          }
      }
  
      public static void setImage_filepath(String fp) {
          image_filepath = fp;
      }
  
      public String getImage_filepath() {
          return image_filepath;
      }
  
      @Override
      public void onDestroy() {
          finish();
          super.onDestroy();
      }
  
      public void createStorageDirectory() {
          sd = Environment.getExternalStorageDirectory();
          storageFolder = new File(sd, Globals.STORAGE_DIRECTORY);
          if (sd.canWrite()) {
              if (!storageFolder.exists())
                  storageFolder.mkdir();
              mediaFolder = new File(sd, Globals.STORAGE_DIRECTORY
                      + Globals.MEDIA_DIRECTORY);
              if (!mediaFolder.exists())
                  mediaFolder.mkdir();
          }
      }
  }
  </code></pre>