Okhttp: Static interface methods are only supported starting with Android N in Kotlin 1.3.20

Created on 27 Feb 2019  路  2Comments  路  Source: square/okhttp

When I've added the library in gradle and build, I got an error.

implementation 'com.squareup.okhttp3:logging-interceptor:3.13.1'

Static interface methods are only supported starting with Android N

Most helpful comment

Per the release notes, OkHttp requires that you enable Java 8 in your builds to function as of 3.13 and newer. You can learn more about how to enable this at https://developer.android.com/studio/write/java8-support.

You need to add something like

android {
    compileOptions {
        targetCompatibility = "8"
        sourceCompatibility = "8"
    }
}

to your application build.gradle.

All 2 comments

Per the release notes, OkHttp requires that you enable Java 8 in your builds to function as of 3.13 and newer. You can learn more about how to enable this at https://developer.android.com/studio/write/java8-support.

You need to add something like

android {
    compileOptions {
        targetCompatibility = "8"
        sourceCompatibility = "8"
    }
}

to your application build.gradle.

Thank you.
Now it's working fine.

Was this page helpful?
0 / 5 - 0 ratings