question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidDefinitionExceptions using kotlin 1.6.0

See original GitHub issue

Describe 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:open
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
C2H6Ocommented, Jan 21, 2022

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.

2reactions
RabieJradicommented, Jan 12, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found