Kotlin Metadata issue
See original GitHub issueI 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 of
MyKotlinClass (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 of
void com.fasterxml.jackson.databind.ext.DOMSerializer.()| Type
org.conscrypt.Conscryptwas not found, it is required for default or static interface methods desugaring of
d.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:
- Created 5 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
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.
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.