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.