title: gson NoSuchFieldException error
body: <p>I'm trying to convert a custom object to JSON and then save it to SharedPreferences. When I try to do that, the app crashes giving a <code>NoSuchFieldException</code> error.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>User myUser= new User("a", "b", 2, getApplicationContext());
  SharedPreferences.Editor prefsEditor = mPrefs.edit();
  Gson gson = new Gson();
  String json = gson.toJson(myUser);
  prefsEditor.putString(myUser.getUserPhone(), json);
  prefsEditor.commit();
  </code></pre>
  
  <p>I think the problem lies at the <code>gson.toJson</code> conversion, because when I comment it the app doesn't crash anymore. </p>
  
  <p>Any suggestion?  Thanks</p>
  
  <p><strong><em>Logcat:</em></strong></p>
  
  <pre><code>   java.lang.AssertionError: java.lang.NoSuchFieldException: ASCENDING
          at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.&lt;init&gt;(TypeAdapters.java:791)
          at com.google.gson.internal.bind.TypeAdapters$30.create(TypeAdapters.java:817)
          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.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53)
          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(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.MapTypeAdapterFactory.create(MapTypeAdapterFactory.java:126)
          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(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(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(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(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.Gson.toJson(Gson.java:661)
          at com.google.gson.Gson.toJson(Gson.java:648)
          at com.google.gson.Gson.toJson(Gson.java:603)
  </code></pre>