Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Retrofit & Okhttp #13

Open
guillev2m opened this issue Aug 28, 2018 · 2 comments
Open

Problem with Retrofit & Okhttp #13

guillev2m opened this issue Aug 28, 2018 · 2 comments

Comments

@guillev2m
Copy link

When I add the dependency
compile 'com.realexpayments.hpp.sdk:rxp-hpp-android:1.2'
I get this crash error:

java.lang.RuntimeException: Retrofit detected an unsupported OkHttp on the classpath.
To use OkHttp with this version of Retrofit, you'll need:
1. com.squareup.okhttp:okhttp:1.6.0 (or newer)
2. com.squareup.okhttp:okhttp-urlconnection:1.6.0 (or newer)
Note that OkHttp 2.0.0+ is supported!
at retrofit.Platform.hasOkHttpOnClasspath(Platform.java:186)
at retrofit.Platform.access$300(Platform.java:37)
at retrofit.Platform$Android.defaultClient(Platform.java:122)
at retrofit.RestAdapter$Builder.ensureSaneDefaults(RestAdapter.java:686)
at retrofit.RestAdapter$Builder.build(RestAdapter.java:676)
at com.realexpayments.hpp.ApiAdapter.getAdapter(ApiAdapter.java:19)
at com.realexpayments.hpp.HPPManagerFragment.onAttach(HPPManagerFragment.java:93)
at android.app.Fragment.onAttach(Fragment.java:1464)

So adding

compile 'com.squareup.okhttp:okhttp:1.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'

I get this error response in hppManagerFailedWithError method:

No virtual method open(Ljava/net/URL;)Ljava/net/HttpURLConnection; in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/com.geomobile.tmbmobile-pmA28ANdnNr8GrLjnwqjlQ==/split_lib_dependencies_apk.apk!classes62.dex)

With updated dependencies to:

compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'

the error changes to

No field METHODS of type Ljava/util/Set; in class Lcom/squareup/okhttp/internal/http/HttpMethod; or its superclasses (declaration of 'com.squareup.okhttp.internal.http.HttpMethod' appears in /data/app/com.geomobile.tmbmobile-Z0HuYnHyWLHllogWx4xbUw==/split_lib_dependencies_apk.apk!classes62.dex)

In my app i'm already using retrofit 2 and okhttp 3

compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'

Any advice? Thanks!

@jrbistuer
Copy link

Hi @guillev2m , did you come out with some solution to this issue?

@guillev2m
Copy link
Author

Hi @jrbistuer, this happened a long time ago... I don't remember much but checking the repository I see that we ended up using an .aar (no idea of its origin, sorry) with this configuration:

compile(name:'rxp-hpp-android-release', ext:'aar')
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'org.apache.httpcomponents:httpcore:4.4.4'

sorry I can't help you more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants