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
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.
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
to your application
build.gradle.