美文网首页
kotlin fastjson default construc

kotlin fastjson default construc

作者: new_xd | 来源:发表于2018-04-25 09:11 被阅读0次

异常

com.alibaba.fastjson.JSONException: default constructor not found. class xxx

原因

提高了fastjson版本

compile 'com.alibaba:fastjson:1.2.46'

解决方法

降低版本

compile 'com.alibaba:fastjson:1.2.32'

故事

今天把同事的最新代码合入,发生了上述错误,但是我们的代码没有改,kotlin的定义也没有动,反编译apk,也有无参改造函数。
而同事的代码也没有修改fastjson的版本,怀疑是某个lib,使用了更高版本的fastjson。

于是把新代码中的依赖做如下处理

    compile ('xxx:yyy:zzz'){
        exclude group: 'com.alibaba', module: 'fastjson' 
    }

重新编译果然没有问题了。

于是在原来没问题的代码上修改fastjson版本测试,果然出问题。

相关文章

网友评论

      本文标题:kotlin fastjson default construc

      本文链接:https://www.haomeiwen.com/subject/vvrelftx.html