How to get a Kotlin KClass from a package class name string?

You can use Java’s method of getting a Class instance Class.forName and then convert it to a KClass using the .kotlin extension property. The code then looks like this:

val kClass = Class.forName("mypackage.MyClass").kotlin

A more direct way may be added at some point. The issue is located here

Leave a Comment