My code in local host is working good but in real host get this error.
"Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $"
When i add json to my code , it gives another error like this.
"com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $"
and this is my code :
public class ApiClient {
private static final String BASE_URL = "http://aminkhataei.ir/android_login_api/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit == null) {
Gson gson = new GsonBuilder()
.create();
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
}
}
and my model :
public class MyResponse {
@SerializedName("uid")
private String uid;
@SerializedName("error")
private boolean error;
@SerializedName("msg")
private String msg;
public String getMsg() {
return msg;
}
public String getUid() {
return uid;
}
public boolean isError() {
return error;
}
public void setError(boolean error) {
this.error = error;
}
}
Can anyone help me ?