Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
Kotlin Reflection with Proguard fails

Let's say I have this class

data class Person(val name: String?)

When I proguard and run the app I am getting the following exception

kotlin.reflect.jvm.internal.KotlinReflectionInternalError: No accessors or field is found for property val com.whatever.packagee.Person.name: kotlin.String?

I also found that the issue is thrown from this reflection codebase. Any help would be appreciated

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Please make sure to not use too broad -keep options, this will prevent ProGuard from properly optimising and shrinking the code.

It's important to preserve the fields of classes you wish to serialise. Based on the exception you see I would expect a -keep option similar to the one below would do the trick;

-keep class com.whatever.packagee.Person {
    <fields>;
}

You can experiment with these -keep options via the ProGuard Playground, which is quite useful to see what parts of code are affected with your -keep rules. This way you can inspect if all cases of serialization were tackled. I created a Playground for this particular case: Playground link

over 4 years ago · Santiago Trujillo Report

0

This solved the issue for me.

Add following to proguard rules

-keep class kotlin.reflect.jvm.internal.**

-keep class kotlin.Metadata { *; }

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!