Android upload error

20 views
Skip to first unread message

Geetanjali

unread,
Nov 2, 2012, 2:24:22 AM11/2/12
to blrdroi...@googlegroups.com
Hello,

I have been trying to upload an image and data to Django server. I have included apache-mime4j.0.6.jar and httpmime4.0.1.jar libraries ( Project->build path-> Add external jar files) And here's what I have tried 


HttpResponse response = null;
try {
               
                HttpPost httppost = new HttpPost("http://10.0.2.2:8000/mobile/");
               

                 

                    MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);  
                    multipartEntity.addPart("name", new StringBody("nameText"));
                    multipartEntity.addPart("place", new StringBody("placeText"));
                    multipartEntity.addPart("tag", new StringBody("tagText"));
                    //multipartEntity.addPart("Description", new StringBody(Settings.SHARE.TEXT));
                    multipartEntity.addPart("Image", new FileBody(destination));
                    httppost.setEntity(multipartEntity);

                    httpclient.execute(httppost);

                } catch (Exception e) {
                    Log.e( "Error","error");
                }


Error message: 

Could not find class 'org.apache.http.entity.mime.MultipartEntity'


And I have tried manually creating libs folder and manually including jar files into /libs folder. When I do that it fails to compile.

Error:

Conversion to Dalvik format failed with error 1 Unkonws Android Packaging Problem

Tried creating fresh application including libraries. And I encountered the same error. I've tried everything possible. Can anyone tell me why this happens and how to fix it?

Any help would be greatly appreciated!!

Cheers        


Pranay Airan

unread,
Nov 2, 2012, 2:35:10 AM11/2/12
to blrdroi...@googlegroups.com
the problem here is with the jars you are using, this jars are not compiled for Android they might be using different Java version which is not compatible with Dalvik, what you can do is try some other library to do the same thing, there will be lot of libraries which can help you just use word android when you are searching
--
Cheers
Pranay


Reply all
Reply to author
Forward
0 new messages