Apollo-android: Cannot access class 'okhttp3.OkHttpClient'. Check your module classpath for missing or conflicting dependancies

Created on 3 Jun 2019  路  5Comments  路  Source: apollographql/apollo-android

I can't configure my ApolloClient in my project, okhttp is not found
I use the last version of Android Studio (3.4.1) and Gradle is in 5.1.1

Most helpful comment

We might need to declare okhttp as an api dependency and not implementation there: https://github.com/apollographql/apollo-android/blob/30870cc56c71efe5a80a0358e49cf38e0895172b/apollo-runtime/build.gradle#L9

You can workaround this by adding okhttp explicitely to your compile classpath:

    implementation 'com.squareup.okhttp3:okhttp:3.12.2'

All 5 comments

Downgrading Gradle to 4.10.1 seems to fix the issue

Any chance you can setup a small sample app that reproduce the problem ?

Hey Martin :)
Here is a sample I just setup : https://github.com/benju69/ApolloTest

We might need to declare okhttp as an api dependency and not implementation there: https://github.com/apollographql/apollo-android/blob/30870cc56c71efe5a80a0358e49cf38e0895172b/apollo-runtime/build.gradle#L9

You can workaround this by adding okhttp explicitely to your compile classpath:

    implementation 'com.squareup.okhttp3:okhttp:3.12.2'

Hmm yesterday I have tried to add Okhttp directly in my gradle but new errors are coming

Was this page helpful?
0 / 5 - 0 ratings