Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

120
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda