java.lang.StackOverflowError at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
<p>I'm implementing "RealM" in my Android app. I'm getting JSON data by calling service with the help of "Retrofit library".</p>

<p>My Model Class is--</p>

<pre><code>public class Game extends RealmObject
{
    @Expose
    @SerializedName("gameID")
    @PrimaryKey
    private int gameID;
    @Expose
    @SerializedName("gameName")
    private String gameName;
    @Expose
    @SerializedName("gameFormat")
    private String gameFormat;
    @Expose
    @SerializedName("gameType")
    private String gameType;
    @Expose
    @SerializedName("imageUrl")
    private String imageUrl;

    public Game() {
        super();
        // TODO Auto-generated constructor stub
    }

    public Game(int gameID, String gameName, String gameFormat, String gamType, String imageUrl) {
        super();
        this.gameID = gameID;
        this.gameName = gameName;
        this.gameFormat = gameFormat;
        this.gameType = gamType;
        this.imageUrl = imageUrl;
    }

    public int getGameID() {
        return gameID;
    }

    public void setGameID(int gameID) {
        this.gameID = gameID;
    }

    public String getGameName() {
        return gameName;
    }

    public void setGameName(String gameName) {
        this.gameName = gameName;
    }

    public String getGameFormat() {
        return gameFormat;
    }

    public void setGameFormat(String gameFormat) {
        this.gameFormat = gameFormat;
    }

    public String getGameType() {
        return gameType;
    }

    public void setGameType(String gamType) {
        this.gameType = gamType;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }
}
</code></pre>

<p>Following is my OnfieldAPI interface to handle the request--</p>

<pre><code> public interface OnfieldAPI 
{

    Globals global=Globals.getInstance();
    String email=global.getUserName();

    @POST("games")
    Call&lt;GamesResponse&gt; getactivegames(@Header("authtoken") String authtoken);
}
</code></pre>

<p>And this is how I'm calling my web service to get Game response--</p>

<pre><code>public void requestAllgames() {
        Globals globals = Globals.getInstance();
        loading.setVisibility(View.VISIBLE);
        Retrofit newRetro = new Retrofit.Builder()
                .baseUrl(globals.getBaseAddress())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        OnfieldAPI loginCheckApi = newRetro.create(OnfieldAPI.class);
        Call&lt;GamesResponse&gt; callPOST = loginCheckApi.getactivegames(globals.getToken());
        callPOST.enqueue(new Callback&lt;GamesResponse&gt;() {
            @Override
            public void onResponse(Call&lt;GamesResponse&gt; call, Response&lt;GamesResponse&gt; response) {

               // My Success code here.

            }

            @Override
            public void onFailure(Call&lt;GamesResponse&gt; call, Throwable t)
            {
                // My Failure Code Here
            }
        });
    }
</code></pre>

<p>Below is my "GamesResponse" class</p>

<pre><code>public class GamesResponse {

    @SerializedName("status")
    @Expose
    private Integer status;
    @SerializedName("msg")
    @Expose
    private String msg;
    @SerializedName("payload")
    @Expose
    private List&lt;Game&gt; payload = new ArrayList&lt;Game&gt;();

    /**
     * No args constructor for use in serialization
     *
     */
    public GamesResponse() {
    }

    /**
     *
     * @param status
     * @param payload
     * @param msg
     */
    public GamesResponse(Integer status, String msg, List&lt;Game&gt; payload) {
        this.status = status;
        this.msg = msg;
        this.payload = payload;
    }

    /**
     *
     * @return
     * The status
     */
    public Integer getStatus() {
        return status;
    }

    /**
     *
     * @param status
     * The status
     */
    public void setStatus(Integer status) {
        this.status = status;
    }

    /**
     *
     * @return
     * The msg
     */
    public String getMsg() {
        return msg;
    }

    /**
     *
     * @param msg
     * The msg
     */
    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     *
     * @return
     * The payload
     */
    public List&lt;Game&gt; getPayload() {
        return payload;
    }

    /**
     *
     * @param payload
     * The payload
     */
    public void setPayload(List&lt;Game&gt; payload) {
        this.payload = payload;
    }
}
</code></pre>

<p>But, when I run my app every time I'm getting following error. Below is my complete error log--</p>

<pre><code> java.lang.StackOverflowError at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)                                                                                at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:358)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:158)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTy
</code></pre>

<p>I googled this error but yet not reach to the solution, so any help for this issue will be really appreciated. Also let me know if I can provide more information for the same. Thank you.  </p>