Default interface methods are only supported starting with Android 7.0 Nougat
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When building Android apps with Java 8 features, you may encounter the compile error "Default interface methods are only supported starting with Android N (--min-api 24)." This happens because default interface methods (added in Java 8) require Android API level 24 (Android 7.0 Nougat) or the D8/R8 desugaring process to work on older devices. The fix depends on your target API level and build tool version — either raise minSdkVersion to 24, or enable Java 8 desugaring in your Gradle configuration so the compiler transforms default methods into compatible bytecode for older Android versions.
What Are Default Interface Methods?
Default methods let you add method implementations directly in an interface using the default keyword:
This allows evolving interfaces without breaking existing implementations — a feature Java 8 introduced that Android adopted later.
Why the Error Occurs
Android compiles Java source into Dalvik/ART bytecode, not standard JVM bytecode. Prior to API 24, the Android runtime did not support invokeinterface instructions targeting default methods. When you use a default method with minSdkVersion below 24 and without desugaring enabled, the build fails:
This also applies to static interface methods and lambda expressions, all of which are Java 8 features.
Fix 1: Enable Java 8 Desugaring (Recommended)
Desugaring transforms Java 8 bytecode into equivalent Java 7-compatible bytecode that runs on any Android version. This is the recommended approach because it does not require raising your minimum API level.
Android Gradle Plugin 4.0+
Kotlin DSL (build.gradle.kts)
Older Gradle Plugin (3.x)
For AGP 3.0-3.6, desugaring is enabled by just setting source/target compatibility:
AGP 3.x uses the legacy desugar tool. AGP 4.0+ uses D8/R8 for more efficient desugaring.
Fix 2: Raise minSdkVersion to 24
If your app only targets Android 7.0+, simply raise the minimum SDK:
This gives you native runtime support for default methods without desugaring, but drops support for devices running Android 6.0 and below.
Fix 3: Kotlin Projects
If your project uses Kotlin, Kotlin interfaces with default implementations compile to bytecode that works on all Android versions:
Kotlin compiles default interface methods using a DefaultImpls companion class, which is compatible with all Android runtimes. You still need Java 8 compatibility settings if Java code in your project uses default methods.
Java 8 Features and Android API Requirements
| Feature | Without Desugaring | With Desugaring |
| Lambda expressions | API 24+ | Any API level |
| Method references | API 24+ | Any API level |
| Default interface methods | API 24+ | Any API level |
| Static interface methods | API 24+ | Any API level |
java.util.stream | API 24+ | Any API level |
java.time | API 26+ | Any API level |
java.util.Optional | API 24+ | Any API level |
Common Pitfalls
- Setting source/target compatibility without enabling desugaring: Setting
sourceCompatibility = JavaVersion.VERSION_1_8alone does not enable desugaring on AGP 4.0+. You must also addcoreLibraryDesugaringEnabled trueand the desugaring dependency for core library APIs likejava.time. - Forgetting to sync Gradle after changes: After modifying
compileOptionsor adding the desugaring dependency, you must sync Gradle for the changes to take effect. The error persists until the build system picks up the new configuration. - Confusing
minSdkVersionwithcompileSdkVersion:compileSdkVersiondetermines which APIs are available at compile time, whileminSdkVersiondetermines which devices can run the app. SettingcompileSdkVersion 34does not fix the error — you need desugaring or a higherminSdkVersion. - Using default methods in annotation processors or libraries: Third-party libraries that expose interfaces with default methods also trigger this error. Ensure your desugaring configuration applies to all modules, including library dependencies.
- Not testing on older devices after enabling desugaring: Desugaring transforms bytecode at build time, but edge cases (especially with
java.timeorjava.util.stream) can behave differently on older runtimes. Always test on a device or emulator running your minimum API level.
Summary
- The error occurs because default interface methods require API 24+ without desugaring
- Enable Java 8 desugaring in Gradle (
coreLibraryDesugaringEnabled true+ desugaring dependency) to support all API levels - Alternatively, raise
minSdkVersionto 24 if you only target Android 7.0+ - Kotlin interface defaults work on all API levels without special configuration
- Always set
sourceCompatibilityandtargetCompatibilitytoJavaVersion.VERSION_1_8in your module'sbuild.gradle

