我正在开发Android中的应用程序。 它必须能的拍照,并发送照片的网页。 这是代码:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("someurl");
MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); //Here throws the exception
multipartEntity.addPart("data",
new InputStreamBody(
new ByteArrayInputStream(byteArray),
"image/png"));
multipartEntity.addPart("caption", new StringBody(filename));
httpPost.setEntity((HttpEntity) multipartEntity);
我在我的类路径(HttpClient的,Apache的mime4j核心,和的HttpCore httpmime)所需的库。 它不会显示在编译时间任何错误。 但是,当我运行该项目,它说:“java.lang.NoClassDefFoundError:org.apache.http.entity.mime.MultipartEntity”,但类并不在坛子里存在(在httpMime,完全一致)。 下面是完整的跟踪:
04-09 10:21:59.362: E/AndroidRuntime(10352): FATAL EXCEPTION: main
04-09 10:21:59.362: E/AndroidRuntime(10352): java.lang.NoClassDefFoundError: org.apache.http.entity.mime.MultipartEntity
04-09 10:21:59.362: E/AndroidRuntime(10352): at com.publidirecta.AppAzafata.IniciarGPSActivity2.enviarImagen(IniciarGPSActivity2.java:206)
04-09 10:21:59.362: E/AndroidRuntime(10352): at com.publidirecta.AppAzafata.IniciarGPSActivity2.onActivityResult(IniciarGPSActivity2.java:196)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.app.Activity.dispatchActivityResult(Activity.java:3908)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.app.ActivityThread.deliverResults(ActivityThread.java:2549)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2595)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.app.ActivityThread.access$2000(ActivityThread.java:121)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.os.Looper.loop(Looper.java:130)
04-09 10:21:59.362: E/AndroidRuntime(10352): at android.app.ActivityThread.main(ActivityThread.java:3701)
04-09 10:21:59.362: E/AndroidRuntime(10352): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 10:21:59.362: E/AndroidRuntime(10352): at java.lang.reflect.Method.invoke(Method.java:507)
04-09 10:21:59.362: E/AndroidRuntime(10352): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
04-09 10:21:59.362: E/AndroidRuntime(10352): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
04-09 10:21:59.362: E/AndroidRuntime(10352): at dalvik.system.NativeStart.main(Native Method)
我试着与旧版本在这个任务中使用的所有罐子的,但它仍然没有工作。 这瓶也出现在Android项目的“引用的库”。
我用尽了一切。 任何人有任何想法,为什么出现这种情况? 我将要抛出自己的窗口。
先感谢您!