janani
janani

Reputation: 1

okhttp3 - Exception in thread "main" java.lang.NoSuchFieldError: Companion

I tried using 3.x and 4.x versions of okhttp, however I am ended up with below exception

Exception in thread "main" java.lang.NoSuchFieldError: Companion
    at okhttp3.internal.Util.<clinit>(Util.kt:72)
    at okhttp3.internal.concurrent.TaskRunner.<clinit>(TaskRunner.kt:309)
    at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:41)
    at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:47)
    at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.kt:471)

I also tried adding okio dependency explicitly, but that did not resolve the error.

Can someone please help me on this.

We use an internal dependency which consume okhttp 4.9.0. When no okhttp is not mentioned explicitly in pom.xml it is being transitively called by the internal dependency, but we still get the exception. When added explicitly with okio 2.8.0 still ended with expection.

I also tried okhttp 4.12 and okio 3.6.0, however no luck.

Upvotes: 0

Views: 961

Answers (0)

Related Questions