[Android] Error: Default interface methods are only supported starting with Android N (–min-api 24): java.util.Collection com.google.common.collect.BiMap.values()

Posted in :

升級完Android Studio 到 3.2.1 之後,重build 專案顯示這個 Error Message:

Error: Default interface methods are only supported starting with Android N (--min-api 24): java.util.Collection com.google.common.collect.BiMap.values()

解法:

as CommonsWare mentioned, for reference add this inside the android {...} closure in the build.gradle for your app module to resolve issue:

android {
...
  compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
...
}

 

說明:就是增加上面 compileOptions 即可。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *