InvalidDefinitionExceptions using kotlin 1.6.0
See original GitHub issueDescribe the bug Hello! First, thanks for maintaining the project and all the work involved.
Since we updated Kotlin (kgp) in our project to 1.6.0 we started to see issues with r8 related with Jackson and Kotlin. Suddenly, the library is unable to de-serialize responses, mapped as data classes from our backend with the following errors
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of [...any dto class...] (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
To Reproduce
Set minifyEnabled
to true in your build script using kgp 1.6.0
Expected behavior A clear and concise description of what you expected to happen.
Versions
Kotlin: 1.6.0
Jackson-module-kotlin: 2.13.0
Jackson-databind: 2.13.0
Additional context
Also using:
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
(1.6.0)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Kotlin 1.6, Jetpack Compose 1.1.0 compilation error
The compile error at the start of the thread is a bug in kotlin 1.6.0 and 1.6.10, this sets only the compose compiler...
Read more >What's new in Kotlin 1.6.0
For Kotlin/JVM, starting with 1.6.0, the compiler can generate classes with a bytecode version corresponding to JVM 17. The new language version ...
Read more >Using Kotlin - Quarkus
Quarkus provides first class support for using Kotlin as will be explained in this guide. Prerequisites. To complete this guide, you need: Roughly...
Read more >Compose to Kotlin Compatibility Map - Android Developers
Read Google's Maven repository for more information. Add the dependencies for the artifacts you need in the build.gradle file for your app or...
Read more >Kotlin 1.6.0 Released - The JetBrains Blog
Kotlin 1.6.0 is now officially released with Stable exhaustive whens, Kover, and new memory manager for Kotlin/Native!
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @k163377, you pointed me in the right direction!
Apparently this is an R8 bug: https://issuetracker.google.com/issues/206855609
Following https://issuetracker.google.com/issues/206855609#comment9 solved the issue.
I’ve been having the same issue as well. I worked around the issue by marking all my classes with a no arg annotation using this compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html#gradle. Definitely not an ideal solution, but I couldn’t get any added proguard exemption rules to have an effect. I’ve tried many different rules, including keeping entire packages both from fasterxml paths and my own code with no luck. I can confirm that the issue disappears if proguard is disabled, but that is not a feasible solution for me unfortunately.