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

Issues with Jackson / JSR310 in Release Builds #50

Open
martinreichart opened this issue Jul 27, 2021 · 1 comment
Open

Issues with Jackson / JSR310 in Release Builds #50

martinreichart opened this issue Jul 27, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@martinreichart
Copy link
Contributor

Describe the bug

During development of an Android App (min SDK 23), everything works fine and all necessary dependencies are found.

However only when creating a release build of the application (even with proguard disabled) the application crashes with the following stacktrace:

java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider com.fasterxml.jackson.datatype.jsr310.JavaTimeModule could not be instantiated at java.util.ServiceLoader.fail(ServiceLoader.java:233) at java.util.ServiceLoader.access$100(ServiceLoader.java:183) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:392) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:416) at java.util.ServiceLoader$1.next(ServiceLoader.java:494) at com.fasterxml.jackson.databind.ObjectMapper.findModules(ObjectMapper.java:1081) at com.fasterxml.jackson.databind.ObjectMapper.findModules(ObjectMapper.java:1065) at com.fasterxml.jackson.databind.ObjectMapper.findAndRegisterModules(ObjectMapper.java:1115) ..... Suppressed: java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider com.fasterxml.jackson.datatype.jsr310.JavaTimeModule could not be instantiated ... 24 more Caused by: java.lang.NoClassDefFoundError: <clinit> failed for class com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; see exception in other thread at com.fasterxml.jackson.datatype.jsr310.JavaTimeModule.<init>(JavaTimeModule.java:119) at java.lang.Class.newInstance(Native Method) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:388) ... 21 more Suppressed: java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider com.fasterxml.jackson.datatype.jsr310.JavaTimeModule could not be instantiated ... 24 more Caused by: java.lang.NoClassDefFoundError: <clinit> failed for class com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; see exception in other thread at com.fasterxml.jackson.datatype.jsr310.JavaTimeModule.<init>(JavaTimeModule.java:119) at java.lang.Class.newInstance(Native Method) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:388) ... 21 more Caused by: java.lang.NoSuchFieldError: No field ISO_ZONED_DATE_TIME of type Lj$/time/format/DateTimeFormatter; in class Lj$/time/format/DateTimeFormatter; or its superclasses (declaration of 'j$.time.format.DateTimeFormatter' appears in /data/app/-3AsahYi2BhLBw_E80LXboQ==/base.apk!classes2.dex) at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.<clinit>(InstantDeserializer.java:80) at com.fasterxml.jackson.datatype.jsr310.JavaTimeModule.<init>(JavaTimeModule.java:119) at java.lang.Class.newInstance(Native Method) 2021-07-27 19:41:07.096 27839-27839/? E/AndroidRuntime: at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:388) ... 21 more

The project has core library desugaring configured and enabled.

Do you know of anybody who uses this library and has similar issues and found a way to resolve or investigate them?

I found several reports, stack overflow entries and mentions of issues with com.fasterxml.jackson.datatype:jackson-datatype-jsr310 on Android but unfortunately all without information about how to resolve them.

@martinreichart martinreichart added the bug Something isn't working label Jul 27, 2021
@oleksandrsarapulovgl
Copy link
Contributor

So, it turns out desugaring doesn't force jackson to properly work with latest date time API. Because of the reason, I got to change min SDK version to 26. Regarding why it worked before preparing release - I assume you used Android studio, and launched app on devices with API 26, and Android studio automatically compiled app without supporting lower APIs in mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants