https://kotlinlang.org logo
Title
k

Khan

01/19/2023, 3:08 PM
Hi, I am using Kotlin reflection in a module and its working fine. But when i created .aar file and used it in another project it started giving error
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/reflect/full/KClasses;
Can someone tell why is that happening and how to fix it.
e

ephemient

01/19/2023, 3:09 PM
AARs don't carry dependencies. you should instead publish to and consume from a Maven repository which will carry the dependency information as metadata.
l

Landry Norris

01/19/2023, 3:33 PM
If the project is built in release mode, symbols can be obfuscated. Add the Keep annotation to the classes to keep if you control them, or add a proguard rule if not.
k

Khan

01/19/2023, 4:19 PM
I have made it work using fat aar lib. It was the same issue as @ephemient mentioned. Thanks for the answers 🙂