本文介绍了Android的FTP上传错误:NoClassDefFoundError的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个FTP上传方式:

I got this ftp upload method:

try {
    SimpleFTP ftp = new SimpleFTP();

    // Connect to an FTP server on port 21.
    ftp.connect("ftp.atw.hu", 21, "username", "password");

    // Set binary mode.
    ftp.bin();

    // Change to a new working directory on the FTP server.
    ftp.cwd("web");

    // Upload some files.
    ftp.stor(new File("/mnt/sdcard/Documents/Festivale.db"));
    //ftp.stor(new File("comicbot-latest.png"));

    // You can also upload from an InputStream, e.g.
    // ftp.stor(new FileInputStream(new File("test.png")), "test.png");
    // ftp.stor(someSocket.getInputStream(), "blah.dat");

    // Quit from the FTP server.
    ftp.disconnect();
} catch (IOException e) {
    // Jibble.
}

我得到了部队密切与以下日志:

I got force close with the following log:

08-27 14:26:09.037: E/AndroidRuntime(2378): FATAL EXCEPTION: main
08-27 14:26:09.037: E/AndroidRuntime(2378): java.lang.NoClassDefFoundError: org.jibble.simpleftp.SimpleFTP
08-27 14:26:09.037: E/AndroidRuntime(2378):     at com.example.festivale_v2.main$8.onClick(main.java:106)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at android.view.View.performClick(View.java:2485)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at android.view.View$PerformClick.run(View.java:9080)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at android.os.Handler.handleCallback(Handler.java:587)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at android.os.Looper.loop(Looper.java:123)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at android.app.ActivityThread.main(ActivityThread.java:3683)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at java.lang.reflect.Method.invokeNative(Native Method)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at java.lang.reflect.Method.invoke(Method.java:507)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-27 14:26:09.037: E/AndroidRuntime(2378):     at dalvik.system.NativeStart.main(Native Method)

谁能告诉我什么是错?我已经试过了我的手机产生相同的错误上。它具有上网权限。

Can someone tell me whats wrong? I've tried it on my phone resulting in the same error. It has internet permission.

推荐答案

该SimpleFTP类显然不能被发现。

The SimpleFTP class obviously cannot be found.

您应该检查你的classpath(项目属性> Java构建路径):

You should check your classpath (project properties > Java build path):


  • 在Libraries选项卡:添加相应的jar

  • 在订单和导出:检查罐子,这样它的出口

这篇关于Android的FTP上传错误:NoClassDefFoundError的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 02:28