Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with client.send() when using R8 #53

Open
tommyjackson opened this issue Sep 11, 2024 · 1 comment
Open

Error with client.send() when using R8 #53

tommyjackson opened this issue Sep 11, 2024 · 1 comment

Comments

@tommyjackson
Copy link

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.

@RyanLCox1
Copy link
Contributor

Thank you for submitting an issue. We'll look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants