Error "Default interface methods are only supported starting with Android 7.0 (Nougat)" in Kotlin
Hello everyone! I'm a beginner in Kotlin and Android development, and I encountered an unclear error when compiling my project. I'm using Android Studio, targetSdkVersion 34, minSdkVersion 21.
\n\nI have an interface with a default method:
\n\ninterface PaymentCallback {\n fun onSuccess(transactionId: String)\n fun onError(error: String)\n fun onProgress(percent: Int) {\n // Default implementation - log the progress\n Log.d("Payment", "Progress: $percent%")\n }\n}\n\nAnd a class that implements it:
\n\nclass MainActivity : AppCompatActivity(), PaymentCallback {\n override fun onSuccess(transactionId: String) {\n Toast.makeText(this, "Payment successful: $transactionId", Toast.LENGTH_LONG).show()\n }\n\n override fun No answers yet.
Log in to leave an answer