You are currently viewing [SOLVED] Android & Gradle error: Default interface methods are only supported starting with Android N (–min-api 24) – easy solution!
Photo by Guido Coppa on Unsplash
Could You Please Share This Post? I Appreciate It And Thank YOU! :) Have A Nice Day!
4.9
(894)

Reason -> Default interface methods are only supported starting with Android N (–min-api 24)

The Android build system generates and bundles app resources and source code into APKs (Android App Bundles), which you can test, deploy, sign, and distribute. Gradle, an advanced build toolkit, is used by Android Studio to automate and control the build process while also allowing you to establish custom build configurations that are flexible.

Android Studio is not required for Gradle or the Android plugin to work. This means you can create Android apps using Android Studio, the command line on your machine, or even machines that don’t have Android Studio installed (such as continuous integration servers). You may learn how to create and execute your app from the command line if you don’t have Android Studio. Whether you build a project from the command line, on a remote machine, or with Android Studio, the build output is the same.

Each build configuration can define its own set of code and resources while reusing sections of your app that are shared across all versions. The Android plugin for Gradle integrates with the build tools to provide processes and adjustable parameters tailored to the development and testing of Android apps.

You will receive the error [ Default interface methods are only supported starting with Android N] due to the missing “compileOptions” configuration in the AndroidManifest.xml file.

Solution -> –min-api 24

Add the missing configuration. Example below.

android {
...
  compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
...
}

Official docs from Google

The Android SDK Platform package. This is required to compile your app for that version.

Several System Image packages. At least one of these is required to run that version on the Android Emulator.Each platform version includes a system image for each supported form factor (handsets, Android TV, and Android Wear). Each form factor may offer variations to match your computer’s processor architecture (such as Intel x86 and ARM EABI). System images labeled Google APIs include access to Google Play services and those labeled Google Play also include Google Play Store.

The Sources for Android package. This includes the source files for the platform. Android Studio may show lines of code from these files while you debug your app.

The revision numbers listed below are for the Android SDK Platform package only. The system images may receive separate updates, usually to resolve bugs with the emulator. There are no release notes for the system images, but you should always keep them up to date.

https://developer.android.com/studio/releases/platforms
Could You Please Share This Post? 
I appreciate It And Thank YOU! :)
Have A Nice Day!

BigData-ETL: image 7YOU MIGHT ALSO LIKE

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 894

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?