Invoke-customs are only supported starting with Android,Static interface methods are only supported

问题1
Invoke-customs are only supported starting with Android O (–min-api 26)
Message{kind=ERROR, text=Invoke-customs are only supported starting with Android O (–min-api 26), sources=[Unknown source file], tool name=Optional.of(D8)}

问题2
Static interface methods are only supported starting with Android N (–min-api 24): org.webrtc.EglBase org.webrtc.EglBase.create()
Message{kind=ERROR, text=Static interface methods are only supported starting with Android N (–min-api 24): org.webrtc.EglBase org.webrtc.EglBase.create(), sources=[Unknown source file], tool name=Optional.of(D8)}

问题3
错误: -source 1.7 中不支持 lambda 表达式
(请使用 -source 8 或更高版本以启用 lambda 表达式)

这3个问题都是因为没有指定jdk 1.8而产生的。

解决方案:
在主工程的build.gradle中添加以下代码,指定jdk版本为1.8

android {
    ......
    //指定jdk版本
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
原创文章 65 获赞 26 访问量 10万+

猜你喜欢

转载自blog.csdn.net/adojayfan/article/details/81531270