I am using retrofit in my app and Gson convertor for JSON. I would like to use database when there is not internet connection. I decided to use Sugar ORM.
but I get an IllegalArgumentException
.
java.lang.IllegalArgumentException: Unable to create converter for class
here is my object
public class User extends SugarRecord implements Parcelable {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("email")
@Expose
private String email;
@SerializedName("name")
@Expose
private String name;
@SerializedName("lastname")
@Expose
private String lastname;
@SerializedName("properties")
@Expose @Ignore
private List<Object> properties = new ArrayList<>();
@SerializedName("rights")
@Expose @Ignore
private String rights;
@SerializedName("photo")
@Expose
private String photo;
@SerializedName("favorites")
@Expose @Ignore
private List<PointsOnMap> favorites = new ArrayList<>();
@SerializedName("token")
@Expose
private String token;
public User() {
}
public User(String name, String lastname, String email, String photo, String token) {
this.name = name;
this.lastname = lastname;
this.email = email;
this.photo = photo;
this.token = token;
}
//getters and setters
Problem is you can't have a variable named
id
in your class when using Sugar since by default it uses its own internal ids. Try renaming touserId
or something like that.