Gson 2.2.2 causing a stackoverflow on 4.2.1 only

前端 未结 2 721
孤街浪徒
孤街浪徒 2021-01-04 13:49

I am developing an app for android which downloads points of interest from a server using JSON strings. Everything was working fine but since I have started testing on 4.2.1

相关标签:
2条回答
  • 2021-01-04 14:24

    So it turns out this is a bug as Erik Nedwidek pointed out. I took the easy route and downgraded gson from 2.2.2 to 1.7.1, everything works a treat now !

    0 讨论(0)
  • 2021-01-04 14:36

    Check out this bug report. http://code.google.com/p/google-gson/issues/detail?id=440

    Comment #12:

    I believe it was in API 17 that the internals of WeakReference and SoftReference changed to be self-referent, which would trigger this. Are you using Gson to serialize a WeakReference or SoftReference? If you are, you should write your own TypeAdapter for those types.

    Something in your code is causing a circular reference and since it works up until 4.2.1 (API 17), it is most likely one of the Java classes. It still could be your code, but I'm highly doubtful.

    0 讨论(0)
提交回复
热议问题