仅在发行版上获取com.fasterxml.jackson.databind.ser.impl.FilteredBeanPropertyWriter的IllegalAccessError

时间:2019-06-04 19:01:18

标签: android jodatime jackson-databind

此崩溃仅在发行版本中发生,在调试版本中工作正常。注入所有依赖项后,它就会在应用启动时发生。

 @JvmStatic
 @Provides
 internal fun provideJackson() = ObjectMapper()
           .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            .registerModule(JodaModule())
            .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)

我正在使用jacksonVersion 2.9.5

// Jackson
'jacksonCore'         : "com.fasterxml.jackson.core:jackson-core:${versions.jacksonVersion}",
'jacksonAnnotations'  : "com.fasterxml.jackson.core:jackson-annotations:${versions.jacksonVersion}",
'jacksonDatabind'     : "com.fasterxml.jackson.core:jackson-databind:${versions.jacksonVersion}",
'jacksonDataTypeJoda' : "com.fasterxml.jackson.datatype:jackson-datatype-joda:${versions.jacksonVersion}",

我尝试将杰克逊(Jackson)更新为2.9.9,但没有用。

这是我遇到的崩溃

java.lang.IllegalAccessError: tried to access class l.c.a.e.n$c[] from class com.fasterxml.jackson.databind.ser.impl.FilteredBeanPropertyWriter
        at com.fasterxml.jackson.databind.ser.impl.FilteredBeanPropertyWriter.b(FilteredBeanPropertyWriter.java:34)
        at com.fasterxml.jackson.datatype.joda.cfg.FormatConfig.<clinit>(FormatConfig.java:22)
        at com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer.forType(DateTimeDeserializer.java:1)
        at com.fasterxml.jackson.datatype.joda.JodaModule.<init>(JodaModule.java:2)
        at c.f.d.a.d.e.a(CatcherModule.kt:4)

经过混淆处理的堆栈跟踪看起来像这样

java.lang.IllegalAccessError: tried to access class l.c.a.e.n$c[] from class com.fasterxml.jackson.databind.ser.impl.FilteredBeanPropertyWriter
        at com.fasterxml.jackson.databind.ser.impl.FilteredBeanPropertyWriter.org.joda.time.format.PeriodFormatterBuilder.toFormatter(FilteredBeanPropertyWriter.java:34)
                                                                              org.joda.time.format.ISOPeriodFormat.standard
        at com.fasterxml.jackson.datatype.joda.cfg.FormatConfig.<clinit>(FormatConfig.java:22)
        at com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer.forType(DateTimeDeserializer.java:1)
        at com.fasterxml.jackson.datatype.joda.JodaModule.<init>(JodaModule.java:2)

1 个答案:

答案 0 :(得分:0)

-keepclassmembers class org.joda.time.format.** { *; }解决了我的问题