1

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();
1
  • Do you solved this?? Commented Jul 13, 2016 at 12:46

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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/"

Comments

0

It's a bug, you can use Parse 1.11.0

2 Comments

But then how will I use my own parse-server for which minimum requirement is 1.13.0
This is solved now in later versions of parse android client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.