'Issue in okhttp3 library RootIndex issue

Tried to implement a library for payment integration and faced with an issue such as this,

Error: Interface `okhttp3.internal.tls.TrustRootIndex(classpath class)` used as super class of `okhttp3.internal.tls.TrustRootIndex$AndroidTrustRootIndex`.

When I disable the library issue is solved. My assumption is that it might be colliding with the okhttp library I have already implemented in the project.



Solution 1:[1]

Finally I found an answer for this issue. Will explain the solution step by step.

  1. I firstly extracted the jar file.
  2. Then inside the jar folder deleted the Okhttp and Okio Folders.
  3. Convert it to jar file again.
  4. Try to integrate this jar file again with the project.

It worked in my case. Please try this solution if any of you hit the same issue.

Solution 2:[2]

For me, it was my two dependent libraries that depended on okhttp, which caused the duplication of okhttp classes, when l comment this dependency,it worked for me.

//    api 'com.squareup.okhttp3:logging-interceptor:+'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Modus Tollens
Solution 2 happy