Hi Everyone, We have an Android SDK written in Kot...
# android
n
Hi Everyone, We have an Android SDK written in Kotlin. Our SDK can be consumed in Apps written in Kotlin as well as Java. We're trying to add an optional method in an interface (i.e with default implementation 
fun method(){}
). Kotlin based Apps won't complain about new method while Java based Apps will complain about implementing the new method added to the interface. Is there any thing we can do so that it's not a breaking change for Java based apps?
g
Since AGP 3.0, if you target java 1.8 you can use Java interface default method. I don't know how you can write a kotlin interface to generate the same bytecode.
🙏 1
e
https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces/ add compiler option
-Xjvm-default=all
(breaks ABI for existing Kotlin users, but source compatibility is fine) or
-Xjvm-default=all-compatibility
if you need to worry about binary compatibility
🙏 1