fastjson更新到最新版后闪退

java.lang.IllegalAccessError: Field 'com.alibaba.fastjson.parser.ParserConfig.autoTypeSupport' is inaccessible to class 'cn.leancloud.AVOSCloud' (declaration of 'cn.leancloud.AVOSCloud' appears in /data/app/xxxxxx/base.apk)

初始化代码:

AVOSCloud.initialize(this, "1KbhNSxDBKNOvAiGQEJqPE6B-gzGzoHsz", "x", "https://x.com")

并且发现AVOSCloud.java中第56行出现报错

版本信息(并不确定哪个是LC组件 所以复制了一大片):

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.preference:preference:1.1.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation('cn.leancloud:storage-android:6.4.4') {
    exclude group: 'com.alibaba', module: 'fastjson'
    exclude group: 'org.ligboy.retrofit2', module: 'converter-fastjson'
}
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.alibaba:fastjson:1.2.68'
implementation 'org.ligboy.retrofit2:converter-fastjson-android:2.2.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'

不知道是否成功
在初始化之前添加一条AutoType白名单:

ParserConfig.getGlobalInstance().addAccept("包名前缀")

可以试下 Java SDK 6.5.0,统一依赖 fastjson 最新的 JVM 版本,不需要专门处理了(就是 exclude group 那些都不用写了)

是这样对吗?

implementation('cn.leancloud:storage-android:6.5.0')

implementation('cn.leancloud:storage-android:6.5.0')

解决