我遇到了来自sdcard的ftp上传文件的问题。对于FTP,我使用的是外部库。它运行正常,但在过去3-4天我收到错误。 Fyi,我使用的是ftp4j-1.6.1.jar
以下是代码:
it.sauronsoftware.ftp4j.FTPClient con = new it.sauronsoftware.ftp4j.FTPClient();
con.connect("ftp");
con.login("as", "addd@2012");
con.changeDirectory("/RequestContent/images");
con.setPassive(true);
con.setType(FTPClient.TYPE_BINARY);
con.upload(new java.io.File(Environment
.getExternalStorageDirectory()
+ "/audiometer/"
+ str_file_name));
con.logout();
con.disconnect(true);
错误:
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): FATAL EXCEPTION: main
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): java.lang.NoClassDefFoundError: it.sauronsoftware.ftp4j.FTPClient
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at com.RecordingAppOLD.ImageCaptureActivity$3.onClick(ImageCaptureActivity.java:114)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at android.view.View.performClick(View.java:2533)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at android.view.View$PerformClick.run(View.java:9320)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at android.os.Handler.handleCallback(Handler.java:587)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at android.os.Handler.dispatchMessage(Handler.java:92)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at android.os.Looper.loop(Looper.java:150)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at android.app.ActivityThread.main(ActivityThread.java:4385)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at java.lang.reflect.Method.invoke(Method.java:507)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
05-05 14:40:07.712: ERROR/AndroidRuntime(10006): at dalvik.system.NativeStart.main(Native Method)