Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid post image to the Server using MultipartEntity
    primarykey
    data
    text
    <p>I have been trying to upload an image and data to <strong><em>Django</em></strong> server. I have included <code>apache-mime4j.0.6.jar</code> and <code>httpmime4.0.1.jar</code> libraries ( Project->build path->Add external jar files) And here's the code to upload an image.</p> <pre><code>HttpResponse response = null; try { HttpPost httppost = new HttpPost("http://10.0.2.2:8000/mobile"); // HttpPost httppost = new HttpPost("some url"); MultipartEntity multipartEntity = new MultipartEntity(); //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, new PhotoUploadResponseHandler()); } catch (Exception e) { Log.e( "Error","error"); } </code></pre> <p>Error message:</p> <pre><code>Could not find class 'org.apache.http.entity.mime.MultipartEntity' </code></pre> <p>And I have tried manually creating libs folder and manually including jar files into /libs folder. When I do that It fails to compile. </p> <p>Error: </p> <pre><code>Conversion to Dalvik format failed with error 1 Unknown Android Packaging Problem </code></pre> <p>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!! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload