Default interface methods are only supported starting with Android 7.0 (Nougat) Default interface methods are only supported starting with Android 7.0 (Nougat) android android

Default interface methods are only supported starting with Android 7.0 (Nougat)


As CommonsWare mentioned, for reference add this inside the android {...} closure in the build.gradle for your app module (app level) to resolve the issue:

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


You should use Java 8 to solve this. Based on the Android documentation, you can do this by clicking menu FileProject Structure.

And change Source Compatibility and Target Compatibility.

Enter image description here

And you can also configure it directly in the app-level build.gradle file:

android {  ...  // Configure only for each module that uses Java 8  // language features (either in its source code or  // through dependencies).  compileOptions {    sourceCompatibility JavaVersion.VERSION_1_8    targetCompatibility JavaVersion.VERSION_1_8  }}


In the app-level Gradle file, you have to write this code:

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

They come from JavaVersion.java in Android.

An enumeration of Java versions.

Before 9: http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html

After 9: http://openjdk.java.net/jeps/223