Whats the recommended way to include an HttpLoggin...
# apollo-kotlin
a
Whats the recommended way to include an HttpLogging Interceptor? I dont want an explicit dependency on the interceptor which messes with the other versions from Apollo itself? Thanks in advance
m
You can add HttpLoggingInterceptor as a dependency. The only reason we keep OkHttp 3.x as a dependency is to stay compatible with Android 14 but if you don't need that, you should be able to use the latest OkHttp
a
Alright thank you!
can i exclude okhttp3 from the dependency then?
m
Not sure what you mean. OkHttp3 (or 4) is needed by Apollo so it needs to be in the classpath
a
Yeah I mean if I include 4 on the class path, haven't seen 4 be default
m
4 should be compatible with 3 mainly
a
Ok thanks, works so far for me
👍 1
w
fyi we’re always on the most recent apollo + okhttp without issues (apollo 2.5.4 and okhttp 4.9.1 right now)
a
I see that 4 should be included, but it's not on my class path by default. Any idea why?
w
Where do you see that it should be included? The POM for Apollo 2.5.4 specifies OkHttp 3.12.11 https://search.maven.org/artifact/com.apollographql.apollo/apollo-runtime/2.5.4/jar
at least its defined in the dependencies listed here
w
I don’t know exactly how the library is published so I try to look at POMs directly instead of the sources. Either way if Martin says
The only reason we keep OkHttp 3.x as a dependency is to stay compatible with Android 14 but if you don’t need that, you should be able to use the latest OkHttp
then I wouldn’t argue that library depends on OkHttp 4, he would know better as a maintainer of Apollo 🙂
m
Yeaaa the Gradle setup of Apollo is a bit weird because we have a Gradle plugin and also integration tests that use the same dependencies. Long story short, we have 2 versions of OkHttp: *
apollo-runtime
uses OkHttp3 to be compatible with as many devices as possible. *
apollo-gradle-plugin
uses OkHttp4 because it runs on the dev machine and there's a lot less limitations (and we want to use the nice Kotlin syntax there)
Since everything is forward compatible, using 3 or 4 on Android should work the same as far as Apollo is concerned.
👍 1