Avatar ·

Error "Default interface methods are only supported starting with Android 7.0" in Kotlin: how to fix?

Hi everyone! I'm new to Kotlin and Android development, and I've encountered a confusing error. I'm writing a simple project with interfaces, and I want to use a default method implementation directly in the interface, like in Java 8. The code is roughly like this: ```kotlin interface Clickable { fun onClick() // abstract method fun showToast() { // method with default implementation println("Clicked!") } } class Button : Clickable { override fun onClick() { showToast() // calling the default method } } ``` In Android Studio everything compiles, but when I run it on an emulator with Android 6.0 (API 23), the app crashes with the error: "Default interface methods are only supported starting with Android 7.0 (Nougat)". I'm using compileSdk 34 and minSdk 21. Why is this happening? After all, Kotlin