jeudi 21 juillet 2022

Can't find constructors of Kotlin class

class Foo(context: Context) { ... }
class Bar(context: Context): Foo(context) { ... }

When I try to construct a Bar like:

Bar::class.java.getConstructor(Context::class.java).newInstance(context)

I get NoSuchMethodError. If I look at Bar::class.java.constructors the result is empty. What am I missing?





Aucun commentaire:

Enregistrer un commentaire