Looking for some help from someone who puts the pro in proguard.
Annotations used by kotlin-reflect (required dependency for jackson-module-kotlin v v2.8.8) are getting stripped out after upgrading to kotlin 1.1.2-3. The error from proguard is:
Warning:kotlin.reflect.jvm.internal.impl.descriptors.CallableDescriptor: can't find referenced class org.jetbrains.annotations.ReadOnly
This is happening for a few annotations, not just ReadOnly. We have tried adding a good ol' catch all but the error still exists:
-keep class org.jetbrains.kotlin.** { *; }
-keep class org.jetbrains.annotations.** { *; }
-keepclassmembers class ** {
@org.jetbrains.annotations.ReadOnly public *;
}
Looking at the source for ReadOnly
it is an @interface
with java.lang.annotations.*
imported for @Documented
, @RetentionPolicy.CLASS
, @Target
Or a shorter version:
-dontwarn kotlin.reflect.jvm.internal.**
The fix for us was to add dontwarn
for the reflect warnings.
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.CallableDescriptor
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.ClassDescriptor
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.ClassifierDescriptorWithTypeParameters
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.annotations.AnnotationDescriptor
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.impl.PropertyDescriptorImpl
-dontwarn kotlin.reflect.jvm.internal.impl.load.java.JavaClassFinder
-dontwarn kotlin.reflect.jvm.internal.impl.resolve.OverridingUtil
-dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor
-dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor
-dontwarn kotlin.reflect.jvm.internal.impl.types.TypeConstructor
These annotations exist in kotlin-compiler which is why proguard can't find them. Just ignore the warning instead of adding kotlin-compiler as a dependency (as this issue suggests Cannot resolve symbol @ReadOnly and @Mutable in Kotlin 1.1.0 compilation).
This may be a bug in kotlin-reflect; they should provide proguard rules to hide this from integrating apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With