With Dagger 2.16 and above I am getting an error with Kapt
error: Dagger does not support injection into private fields.
Upon investigation, the field has indeed been translated into a Private field in the Auto Generated Java file, during compilation by kapt
Has anyone seen this error, is there a fix available?
Adding @JvmField
to the property should fix that.
It’s not kapt by the way, properties in kotlin become a private field plus getter and setter in Java.
1 Like
Could you please explore more on properties in kotlin become a private field plus getter and setter in Java
Any reference is appreciated.
The kotlin documentation on properties and Java interoperability describes that pretty well:
https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#properties
I’m not sure if you had a more specific question in mind.