We use the smartystreets SDK in our Android app, but are noticing the following issue when the app is built obfuscated with R8 and tries to invoke client.send(lookup):
Non-fatal Exception: jd.b: Cannot construct instance of `di.a` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2] (through reference chain: java.lang.Object[][0])
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.<init>(InvalidDefinitionException.java:30)
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1887)
at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:414)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1375)
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:274)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:218)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4905)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3909)
at com.smartystreets.api.SmartySerializer.deserialize(SmartySerializer.java:23)
at com.smartystreets.api.us_street.Client.send(Client.java:51)
at com.smartystreets.api.us_street.Client.send(Client.java:27)
We can remedy this locally by adding the following keep rule to our proguard-rules.pro:
-keep class com.smartystreets.api.** { *; }
but it isn't an ideal solution, as 3rd party libraries should include their own consumer-rules.pro that specify what specific files need to be kept so we don't have to end up keeping an entire library.
We use the smartystreets SDK in our Android app, but are noticing the following issue when the app is built obfuscated with R8 and tries to invoke
client.send(lookup)
:We can remedy this locally by adding the following keep rule to our
proguard-rules.pro
:but it isn't an ideal solution, as 3rd party libraries should include their own
consumer-rules.pro
that specify what specific files need to be kept so we don't have to end up keeping an entire library.