I upgraded to Android Studio 3.1 and get the following error:
Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleObserver.onCreate(android.arch.lifecycle.LifecycleOwner) Message{kind=ERROR, text=Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleObserver.onCreate(android.arch.lifecycle.LifecycleOwner), sources=[Unknown source file], tool name=Optional.of(D8)}

here is my gradle config:
compileSdkVersion 27 //buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 16 targetSdkVersion 27 multiDexEnabled true //... }
As you can see, I am targeting 27 who are already ahead of 24 who are complaining about. What exactly should I do to fix this? If I upgrade to Java 1.8, I wonβt miss many clients? Why didnβt I get this error before updating Android Studio?
I don't know if this concerns the LifecycleObserver class that I recently inserted, it was in kotlin, and now I changed it to java, but still getting the same error after clearing the project:
public class LifeCycleAwareObserver implements LifecycleObserver { @OnLifecycleEvent(Lifecycle.Event.ON_STOP) public void onAppBackgrounded() { AnalyticsUtils.trackStartSession(true); } @OnLifecycleEvent(Lifecycle.Event.ON_START) public void onAppForegrounded() { AnalyticsUtils.trackStartSession(false); }
}
How to track where the error comes from so that I can fix it?
here are my version dependencies:
project.ext { firebase_version = '12.0.0' supportlib_version = '27.0.2' room_version = '1.0.0' espresso_version = '3.0.1' archLifecycleVersion = '1.1.1' }
source share