title: Invalid value for field exception while deserializing object using Gson
body: <p>I have a <code>List</code> of Non-Generic type which i want to store in <code>SharedPreferences</code>. For this, I am using <strong>Gson</strong> to convert the <code>List</code> to String and then storing it to <code>SharedPreferences</code> like this :</p>
  
  <pre><code>Gson gson = new Gson();
  Type fooType = new TypeToken&lt;ArrayList&lt;UserFeedMaster&gt;&gt;() {}.getType();
  // feedTempList is the ArrayList of type UserFeedMaster class
  String gsonFeeds = gson.toJson(feedTempList,fooType);
  prefs.edit().putString("recent_feedlist", gsonFeeds).commit();
  </code></pre>
  
  <p>And later on I am trying to get back the values as <code>ArrayList&lt;UserFeedMaster&gt;</code> in this way :</p>
  
  <pre><code>String gsonFeed = prefs.getString("recent_feedlist", null);
  Gson gson = new Gson();
  Type type = new TypeToken&lt;ArrayList&lt;UserFeedMaster&gt;&gt;(){}.getType();
  List&lt;UserFeedMaster&gt; historyFeeds = gson.fromJson(gsonFeed,type);
  </code></pre>
  
  <p>For Serializing the data, it is working fine. But the problem here is when I am De-serializing it, I get error <code>java.lang.IllegalArgumentException: invalid value for field</code>  at line <code>List&lt;UserFeedMaster&gt; historyFeeds = gson.fromJson(gsonFeed,type);</code></p>
  
  <p><strong>Error Log :</strong></p>
  
  <pre><code>java.lang.IllegalArgumentException: invalid value for field
  at java.lang.reflect.Field.setField(Native Method)
  at java.lang.reflect.Field.set(Field.java:588)
  at com.google.api.client.util.FieldInfo.setFieldValue(FieldInfo.java:245)
  at com.google.api.client.util.FieldInfo.setValue(FieldInfo.java:206)
  at com.google.api.client.util.GenericData.put(GenericData.java:103)
  at com.google.api.client.util.GenericData.put(GenericData.java:47)
  at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:189)
  at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:146)
  at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
  at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
  at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
  at com.google.gson.Gson.fromJson(Gson.java:755)
  at com.google.gson.Gson.fromJson(Gson.java:721)
  at com.google.gson.Gson.fromJson(Gson.java:670)
  at com.myapp.sample.RecentFeedsFragment.onActivityCreated(RecentFeedsFragment.java:178)`
  </code></pre>
  
  <p><strong>UserFeedMaster.java</strong></p>
  
  <pre><code> public class UserFeedMaster {
  
      @Id
      private String feedBlobKey;
      private Date feedDateTime;
      private int feedLikes;
      private boolean feedIsPrivate;
      private boolean userIsAnonymous;
      private String feedTags;
      private boolean isFeedDeleted;
      private double latitude;
      private double longitude;
  
      public double getLatitude() {
          return latitude;
      }
  
      public void setLatitude(double latitude) {
          this.latitude = latitude;
      }
  
      public double getLongitude() {
          return longitude;
      }
  
      public void setLongitude(double longitude) {
          this.longitude = longitude;
      }
  
      public String getFeedBlobKey() {
          return feedBlobKey;
      }
  
      public void setFeedBlobKey(String feedBlobKey) {
          this.feedBlobKey = feedBlobKey;
      }
  
      public Date getFeedDateTime() {
          return feedDateTime;
      }
  
      public void setFeedDateTime(Date feedDateTime) {
          this.feedDateTime = feedDateTime;
      }
  
  
      public int getFeedLikes() {
          return feedLikes;
      }
  
      public void setFeedLikes(int feedLikes) {
          this.feedLikes = feedLikes;
      }
  
      public boolean isFeedIsPrivate() {
          return feedIsPrivate;
      }
  
      public void setFeedIsPrivate(boolean feedIsPrivate) {
          this.feedIsPrivate = feedIsPrivate;
      }
  
      public boolean isUserIsAnonymous() {
          return userIsAnonymous;
      }
  
      public void setUserIsAnonymous(boolean userIsAnonymous) {
          this.userIsAnonymous = userIsAnonymous;
      }
  
      public String getFeedTags() {
          return feedTags;
      }
  
      public void setFeedTags(String feedTags) {
          this.feedTags = feedTags;
      }
  
      public boolean isFeedDeleted() {
          return isFeedDeleted;
      }
  
      public void setFeedDeleted(boolean isFeedDeleted) {
          this.isFeedDeleted = isFeedDeleted;
      }
  
  }
  </code></pre>
  
  <p><strong>JSON response :</strong></p>
  
  <pre><code>[
      {
          "feedBlobKey": "AMIfv944GCtKglU0zOhVTq6F0dG9Aj1LxtIN5Qz0d3CuaRWO3MWIXd_1eCBxVJA_T6FNjx83hq-ORmnAoivTz2IxL120iQYtePBUPoTru6sxKj5iLZmkRxqaIodwEgknUQPvrkEG_37rlUIoycRHUwnPJlmc_6lmtN32tw9-b5NW60wP7u5AHZY",
          "feedDateTime": {
              "value": 1396953609433,
              "tzShift": 0,
              "dateOnly": false
          },
          "feedDeleted": false,
          "feedIsPrivate": false,
          "feedLikes": 0,
          "kind": "userfeedmasterendpoint#resourcesItem"
      },
      {
          "feedBlobKey": "AMIfv944GCtKglU0zOhVTq6F0dG9Aj1LxtIN5Qz0d3CuaRWO3MWIXd_1eCBxVJA_T6FNjx83hq-ORmnAoivTz2IxL120iQYtePBUPoTru6sxKj5iLZmkRxqaIodwEgknUQPvrkEG_37rlUIoycRHUwnPJlmc_6lmtN32tw9-b5NW60wP7u5AHZY",
          "feedDateTime": {
              "value": 1396953609433,
              "tzShift": 0,
              "dateOnly": false
          },
          "feedDeleted": false,
          "feedIsPrivate": false,
          "feedLikes": 0,
          "kind": "userfeedmasterendpoint#resourcesItem"
      }
  ]
  </code></pre>
  
  <p>I don't know what is going wrong. Please help me on why I am getting this error and how can I resolve it. 
  Thanks in advance.</p>