FileNotFoundException on Android version > 2.3
Simple remove urlConnection.setDoOutput(true);
Thanks to pfn @ #android-dev
So to answer the original question, a FileNotFoundException
also comes when you get an error message from the server and then try to access getInputStream()
. If the Response code is a 400 or above, any call to getInputStream()
will throw this error. In this case, you should check getErrorStream()
instead. See my answer here.