I have recently updated my Android Studio to 3.1 and I am starting receiving this error:
Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleObserver.a(android.arch.lifecycle.h) Message{kind=ERROR, text=Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleObserver.a(android.arch.lifecycle.h), sources=[Unknown source file], tool name=Optional.of(D8)}
Here is my app build.gradle file contents:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 27
defaultConfig {
applicationId "com.sample"
minSdkVersion 21
targetSdkVersion 27
versionCode 11
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
I am also using following Android Architecture Components:
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "android.arch.lifecycle:common-java8:1.1.1"
implementation "android.arch.persistence.room:runtime:1.0.0"
implementation "android.arch.persistence.room:rxjava2:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
Besides this, I am also using Gradle build tools version 3.1.0 and Gradle version is 4.4.
After searching a bit on similar issue, I have also tried this in project gradle.properties without luck:
android.enableD8=true
Everything works fine in Android Studio 3.0, but as soon as I upgraded to 3.1 I started receiving this error.
android.enableDesugar=false- 0xAliHnimplementation "android.arch.lifecycle:common-java8:1.1.1”. Just for fun, have you tried the “normal”annotationProcessor "android.arch.lifecycle:compiler:1.1.1”? I know it’s not the same, but it may be a bug in the library :) (I’m reading developer.android.com/topic/libraries/architecture/…) - Martin Marconcini