問題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
}
}