We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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 seeing this exact same behavior. I am successfully posting from my Processing app on the desktop, but failing when I port the same code to Android and run from my cell phone. Where do you find the stack trace? I am only seeing that my app crashes just after completing the HTTP POST - from the looks of this, and having looked through the code of the HTTP-Requests library, this is the code that processes the returned content in the response. EntityUtils.consume is called to extract the response data, and assign it to the
contentinstance variable of the PostRequest object. I don't know why there would be no such method though.
Here is the code in PostRequest that executes the post, and then immediately following, processes the response:
this is pretty damning. i think the standard android http library is cut down from the PC version and doesn't have all the methods.
in that code line 3 and line 5 look to be doing the same thing, only the result of line 3 isn't used (in the snippet). if line 3 works and line 5 doesn't (NoSuchMethod) then just drop line 5.
yes, android documentation for EntityUtils shows no consume():
suggests that above api level 22 the whole httpclient has been deprecated... but i'm still using android4 something so...