android issue FATAL EXCEPTION:
i'm testing with really simple android app which save the captured image then upload to the server on each time during the http post session the app got crashed,reported as following:
FATAL EXCEPTION: Animation Thread java.lang.NoSuchMethodError: org.apache.http.util.EntityUtils.consume at http.requests.PostRequest.send(Unknown Source) at processing.test.android_image.android_image.postImg(android_image.java:145) at processing.test.android_image.android_image.draw(android_image.java:56) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:841)
but without any issue running on desktop. any ideas?
I believe I am having this same error. Runs ok from desktop but fails when run from my Android phone. This program illustrates the problem:
import http.requests.*;
public void setup()
{
size(800,800);
background(32);
smooth();
}
public void draw() {
}
public void mouseReleased() {
JSONObject rpt = new JSONObject();
rpt.setLong("ts", System.currentTimeMillis());
JSONArray latlng = new JSONArray();
latlng.append(mouseX);
latlng.append(mouseY);
rpt.setJSONArray("posn", latlng);
PostRequest post = new PostRequest("http://192.168.1.12:11111/echo", "UTF-8");
post.addHeader("Content-Type", "application/json");
post.addData("", rpt.format(0));
post.send();
}
The web page is just a 10-line Python/falcon server that echoes the inbound request body to standard output. (I had to do some hacky stuff to get the JSON from the form-like request body - I can post that elsewhere.)
I too. I wrote a small sketch . It calls a website using getRequest. Simple. It works well in java mode but fails when downloaded to my 2 android tablet/phones . Same fatal exception of yours. I was considering to use another library but I don t know any other http library.