ByteArrayBody无法解析为

时间:2015-07-01 09:23:38

标签: java android

我试图将字节数组图像发送到服务器

我用过:

  MultipartEntity entity = new MultipartEntity(
                        HttpMultipartMode.BROWSER_COMPATIBLE);

                //Set Data and Content-type header for the image
                entity.addPart("file", new ByteArrayBody(ba, "image/jpeg", "file"));
                postRequest.setEntity(entity);

我有这个错误

" ByteArrayBody无法解析为类型"

我导入了我的项目  所有httpmime,httpclient和httpcore jars !!

我不知道还能做什么 提前谢谢。

1 个答案:

答案 0 :(得分:0)

如果您使用的是httpmime 4.0 jar,则会显示错误ByteArrayBody cannot be resolved to a type.

需要替换为httpmime 4.1 or later versions,然后才能正常工作。

ByteArrayBody来自httpmime 4.1.jar onwards

更多参考httpmime 4.04.1