预计BEGIN_OBJECT但在第1行第1列是STRING Ocuure Illigal语句异常和JsonSyntaxException
这是我的RegisterFragment中的内容:
User user = new User();
user.setName(name);
user.setEmail(email);
user.setPassword(password);
registerProcess(user);
private void registerProcess(User user) {
mSubscriptions.add(NetworkUtil.getRetrofit().register(user)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(this::handleResponse, this::handleError));
}
private void handleResponse(MyResponse response) {
mProgressbar.setVisibility(View.GONE);
showSnackBarMessage(response.getMessage());
}
private void handleError(Throwable error){
mProgressbar.setVisibility(View.GONE);
if (error instanceof HttpException) {
Gson gson = new GsonBuilder().create();
try {
String errorBody = ((HttpException) error).response().errorBody().string();
MyResponse response = gson.fromJson(errorBody, MyResponse.class);
Log.i(TAG, "handleError: "+ response.getMessage());
showSnackBarMessage(response.getMessage());
} catch (IOException e) {
e.printStackTrace();
}
} else {
showSnackBarMessage("Network Error !");
}
}