zoukankan      html  css  js  c++  java
  • 【Gson】2.2.4 StackOverflowError 异常


    正文

    错误:

    08-09 09:56:51.904: E/AndroidRuntime(16384): java.lang.StackOverflowError
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at java.lang.Class.isArray(Class.java:1044)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:331)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:355)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:117)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.Gson.getAdapter(Gson.java:353)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
    08-09 09:56:51.904: E/AndroidRuntime(16384):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)

    原因:

     我这边的情况是序列化对象嵌套了"其他对象",而赋值的时候又是这个"其他对象"的子类,导致了这个异常。网上游遇到同样错误的建议换到1.7.1版本,我换了还是报错。

  • 相关阅读:
    C++对象模型与内存位对齐的简单分析(GNU GCC&VS2015编译器)
    [GeekBand] C++学习笔记(2)——BigThree、OOP
    [GeekBand] C++ 高级编程技术 (1)
    [GeekBand]C++高级编程技术(2)
    C++中引用的本质分析
    函数的重载(1)
    C++的特点
    布尔类型和三目运算符
    Linux客户端下的latex相关操作
    无光驱上网本上安装win7
  • 原文地址:https://www.cnblogs.com/over140/p/3659221.html
Copyright © 2011-2022 走看看