0

I am using Parse with Heroku in my application. But I am getting the error, com.parse.ParseRequest$ParseRequestException: bad json response.

i did a lot of research, and found that some people had problem in the format of the server(url), where they needed to add / after /parse. But I have the correct format of the URL written in the code.

This is my code below:

  Parse.initialize(new 
  Parse.Configuration.Builder(getApplicationContext())
            .applicationId("APP_ID")
            .clientKey(null)
            .server("https://abc-xyz.herokuapp.com/parse/").build()
  );

  ParseObject gameScore = new ParseObject("GameScore");
  gameScore.put("score", 1337);
  gameScore.put("playerName", "Sean Plott");
  gameScore.put("cheatMode", false);
  gameScore.saveInBackground(new SaveCallback() {
      public void done(ParseException e) {
          if (e == null) {  // the error is always 'bad JSON response' here
              Log.i("Parse", "Save Succeeded");
          } else {
              Log.i("Parse", "Save Failed");
          }
      }
  });

Also, just to give you another update,

I am getting the same error. I was using compile 'com.parse:parse-android:1.13.0', but I changed it to compile 'com.parse:parse-android:1.12.0', therefore, it gives 'cannot resolve symbol' on server(url).build().

Also, if I am using, compile 'com.parse:parse-android:1.10.0', I am getting the same error, i.e., 'cannot resolve symbol' on Configuration, in the above code.

This is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.parse.starter"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '25.0.0'
}

dependencies {
    compile 'com.android.support:appcompat-v7:22.2.0'

    compile 'com.parse.bolts:bolts-tasks:1.4.0'
    compile 'com.parse:parse-android:1.13.0'
}

Can somebody provide some solution for this.

Thanks in advance.

1 Answer 1

1

I think your error is caused due to wrong clientKey and applicationId.

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

3 Comments

Hi Anubhav, i am using the same clientKey and appId, that is being used on Heroku dashboard.
do u have any other solution for this issue??
I think this issue still exits in Parse SDK. you can take a look at this link [link]github.com/parse-community/Parse-SDK-Android/issues/334

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.