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.

Kotlin Metadata issue

See original GitHub issue

I have used jackson-module-kotlin successfully in my debug build but can’t get it working on release build with Proguard on. First I added this line to my proguard-rules.pro:

  • dontwarn kotlin.**

The App crashes when trying to deserialize first Kotlin class. com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance ofMyKotlinClass (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

Did some research and found out that I also need to add the following:

  • keep class kotlin.Metadata { *; }

The outcome is that app crashes immediately when launched. java.lang.ExceptionInInitializerError at kotlin.h.b.a.b.a.b.<clinit>(Unknown Source) at kotlin.h.b.a.b.a.i.b(Unknown Source) at kotlin.h.b.a.b.g.b.<init>(Unknown Source) at kotlin.h.b.a.b.g.b.<init>(Unknown Source) at kotlin.h.b.a.ac.a(Unknown Source) at kotlin.h.b.a.m$b$a.A_(Unknown Source) at kotlin.h.b.a.ad$a.a(Unknown Source) at kotlin.h.b.a.m$b.e(Unknown Source) at kotlin.h.b.a.j$a$i.A_(Unknown Source) at kotlin.h.b.a.ad$a.a(Unknown Source) at kotlin.h.b.a.j$a.a(Unknown Source) at kotlin.h.b.a.j.g(Unknown Source) at kotlin.h.b.a.j.b(Unknown Source) at kotlin.h.b.a.j$a$e.A_(Unknown Source) at kotlin.h.b.a.ad$a.a(Unknown Source) at kotlin.h.b.a.j.e(Unknown Source) at kotlin.h.b.b.a(Unknown Source) at com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector.findKotlinParameterName(Unknown Source) at com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector.findImplicitPropertyName(Unknown Source) at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findImplicitPropertyName(Unknown Source)

I do get the following warning when building app/build/intermediates/transforms/proguard/release/0.jar Type org.w3c.dom.bootstrap.DOMImplementationRegistrywas not found, it is required for default or static interface methods desugaring ofvoid com.fasterxml.jackson.databind.ext.DOMSerializer.()|   Typeorg.conscrypt.Conscryptwas not found, it is required for default or static interface methods desugaring ofd.a.g.f d.a.g.b.b()

My development environment is Android Studio 3.1.2 Build #AI-173.4720617, built on April 14, 2018 JRE: 1.8.0_152-release-1024-b01 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
pmellaahocommented, Jun 1, 2018

Seems like the following is also very much needed in proguard-rules: -keep class kotlin.reflect.** { *; }

Maybe this could mentioned in the front page “Caveats” -chapter.

1reaction
6bangscommented, Jul 15, 2018

I just ran into this as well and couldn’t find the referenced SO post, so I opened a PR with the note in the readme. It’s not clear to me why we need kotlin.reflect, so let me know how I can update it with more detail if necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Metadata - Kotlin Programming Language
This annotation is present on any class file produced by the Kotlin compiler and is read by the compiler and reflection. Parameters have...
Read more >
Kotlin Metadata not properly generated · Issue #731 · google/ksp
Context: KMP multi-module project, using kspMetadata to generate code based on an annotation, KSP (snapshot close to 1.6.0-1.0.1 + typealias ...
Read more >
Kotlin Serialization metadata issue due to incompatibility ...
Kotlin Serialization metadata issue due to incompatibility between Gradle Kotlin embedded version and Kotlin Gradle Plugin version.
Read more >
R8: Unexpected error during rewriting of Kotlin metadata for ...
As this is a warning about rewriting the Kotlin metadata for the classes mentioned in the warning message. The only thing affected at...
Read more >
Shrinking Kotlin libraries and applications using ... - Medium
Kotlin metadata is also needed for applications that use Kotlin reflection via the kotlin-reflect library. The issues are exactly the same as ...
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