Kotlin Foo::class.java “Unresolved Reference: Java” error

The issue is most likely that you forgot to depend on the reflection libraries which were needed for the reflective functions of Kotlin.

On the Java platform, the runtime component required for using the
reflection features is distributed as a separate JAR file
(kotlin-reflect.jar). This is done to reduce the required size of the
runtime library for applications that do not use reflection features.
If you do use reflection, please make sure that the .jar file is added
to the classpath of your project.

Source

Leave a Comment