0

我正在尝试将图像从 android 设备上传到在.NET上运行的 Web 服务器。

日志猫显示:

08-30 11:11:50.196: I/dalvikvm(646): Failed resolving Lorg/apache/http/entity/mime/content/ContentBody; interface 875 'Lorg/apache/james/mime4j/descriptor/ContentDescriptor;'
08-30 11:11:50.196: W/dalvikvm(646): Link of class 'Lorg/apache/http/entity/mime/content/ContentBody;' failed
08-30 11:11:50.196: I/dalvikvm(646): Failed resolving Lorg/apache/http/entity/mime/content/InputStreamBody; interface 853 'Lorg/apache/http/entity/mime/content/ContentBody;'
08-30 11:11:50.196: W/dalvikvm(646): Link of class 'Lorg/apache/http/entity/mime/content/InputStreamBody;' failed
08-30 11:11:50.196: E/dalvikvm(646): Could not find class 'org.apache.http.entity.mime.content.InputStreamBody', referenced from method com.example.imageupload.MainActivity.onCreate
08-30 11:11:50.196: W/dalvikvm(646): VFY: unable to resolve new-instance 855 (Lorg/apache/http/entity/mime/content/InputStreamBody;) in Lcom/example/imageupload/MainActivity;
08-30 11:11:50.196: D/dalvikvm(646): VFY: replacing opcode 0x22 at 0x0043
08-30 11:11:50.546: D/dalvikvm(646): GC_FOR_ALLOC freed 50K, 3% free 8960K/9223K, paused 114ms
08-30 11:11:50.586: D/dalvikvm(646): GC_FOR_ALLOC freed 4K, 4% free 9212K/9543K, paused 34ms
08-30 11:11:50.596: D/AndroidRuntime(646): Shutting down VM
08-30 11:11:50.596: W/dalvikvm(646): threadid=1: thread exiting with uncaught exception (group=0x40014760)
08-30 11:11:50.596: E/AndroidRuntime(646): FATAL EXCEPTION: main
08-30 11:11:50.596: E/AndroidRuntime(646): java.lang.NoClassDefFoundError: org.apache.http.entity.mime.content.InputStreamBody
08-30 11:11:50.596: E/AndroidRuntime(646):  at com.example.imageupload.MainActivity.onCreate(MainActivity.java:39)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.app.ActivityThread.access$1500(ActivityThread.java:122)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.os.Looper.loop(Looper.java:132)
08-30 11:11:50.596: E/AndroidRuntime(646):  at android.app.ActivityThread.main(ActivityThread.java:4025)
08-30 11:11:50.596: E/AndroidRuntime(646):  at java.lang.reflect.Method.invokeNative(Native Method)
08-30 11:11:50.596: E/AndroidRuntime(646):  at java.lang.reflect.Method.invoke(Method.java:491)
08-30 11:11:50.596: E/AndroidRuntime(646):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-30 11:11:50.596: E/AndroidRuntime(646):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-30 11:11:50.596: E/AndroidRuntime(646):  at dalvik.system.NativeStart.main(Native Method)

我已将apche-mime4j-0.3.jar、commons-io-2.4.jar、httpmime-4.0-beta1.jar 添加到 libs 文件夹中。

4

1 回答 1

0

这是因为 jar 没有正确连接。

右键单击项目->属性-> java构建路径->在“订单和导出”下并检查所有依赖项

在此处输入图像描述

于 2013-08-30T06:55:48.707 回答