ISHAAN KAKKAR
ISHAAN KAKKAR

Reputation: 65

com.parse.ParseRequest$ParseRequestException: bad json response or i/o failure during file upload

I an using the latest parse android sdk 1.13.0 and a self hosted parse-server. I am getting the following error on file upload using android sdk-> com.parse.ParseRequest$ParseRequestException: bad json response or sometimes com.parse.ParseRequest$ParseRequestException: i/o failure

All other ParseObjects are working properly but not this. Please Help on this issue the full stack trace is below-> https://gist.github.com/ishaan1995/06a7c7abe83414ab4ceb.

my code->

               final ParseFile file = new ParseFile(f);
               file.saveInBackground(new SaveCallback() {
                    public void done(ParseException e) {
                        // Handle success or failure here ..
                        if (e == null) {

                            Toast.makeText(getApplicationContext(), "File Uploaded", Toast.LENGTH_SHORT).show();
                            Log.d("ishaan","uploadede url: "+file.getUrl());

                        } else {
                            Toast.makeText(getApplicationContext(), "Error: " + e.toString(), Toast.LENGTH_SHORT).show();
                            Log.d("ishaan-parse", "" + e.getMessage());
                            e.printStackTrace();
                            Log.d("ishaan-parse",""+e.getCode());
                        }
                        spinner.setVisibility(View.GONE);
                    }
                }, new ProgressCallback() {
                    public void done(Integer percentDone) {
                        // Update your progress spinner here. percentDone will be between 0 and 100.
                        //spinner.incrementProgressBy(percentDone);
                        Log.d("perc", "Done:" + percentDone);
                    }
                });


                ParseObject files = new ParseObject("Files");
                files.put("file_link", file);
                //files.put("compr_data",compFile);

                files.put("file_name",abc);
                files.put("file_desc",desc);
                files.saveInBackground();

Upvotes: 1

Views: 1295

Answers (3)

DanixDani
DanixDani

Reputation: 186

Try to add

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

to your manifest.

Not sure if this will fix the "bad json" error, but for sure it fixed my "i/o failure" while saving the parse file in background.

My parse-server is hosted in AWS and I use S3 as the files bucket. Parse version: 1.13.1

Upvotes: 2

Chris
Chris

Reputation: 4284

I found this issue on github when searching for a related issue with a similar vague parse response (bad json).

https://github.com/ParsePlatform/Parse-SDK-Android/issues/456

The short of it is that the server url you specify must end with a slash. So "https://my.parseserver.com/parse/"

Upvotes: 1

Aiuspaktyn
Aiuspaktyn

Reputation: 980

It's a bug, you can use Parse 1.11.0

Upvotes: 0

Related Questions