8D8: Default interface methods are only supported starting with Android N (--min-api 24): void(示例代码(

满堂花醉三千客,一剑霜寒十四洲。这篇文章主要讲述8D8: Default interface methods are only supported starting with Android N (--min-api 24): void(示例代码(相关的知识,希望能为你提供帮助。
1、错误信息【8D8: Default interface methods are only supported starting with Android N (--min-api 24): void(示例代码(】升级完 android N 后,有些项目运行起来报错信息大致如下:

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)}

 
2、解决方法在 app 下的 build.gradle 文件 android 界面点加入:compileOptions 
android { ... compileOptions { sourceCompatibility javaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ... }

 
原文地址:https://stackoverflow.com/questions/49512629/android-studio-error-default-interface-methods-are-only-supported-starting-with/49525685
 

    推荐阅读