Hey I am working on a library in Kotlin In this l...
# announcements
t
Hey I am working on a library in Kotlin In this library, if I have some variable inside
companion object
, than those variable are treated as static in Java But when I try to access those variable in a java project, which is using library, It is like :
Copy code
MyClass.Companion.abcVariable
I searched and found I had to append @JvmStatic in front of variable so that java can access it directly like :
Copy code
MyClass.abcVariable
This works for
classes
but for
interfaces
it requires a min API level of 24 and my Min API level is 21 Is there any other way to directly access companion object variables for
interface
in API projects supporting min API level less than 24 like :
Copy code
MyClass.abcVariable
c
Seems your problem is related to #C0B8M7BUY you'll probably have more luck in that channel.
t
yes I am working on android, and sure, will share it in #C0B8M7BUY, thanks for sharing
👍 1