globalpayments / rxp-android

Global Payments Ecommerce Android Library
MIT License
9 stars 17 forks source link

Problem with Retrofit & Okhttp #13

Open guillev2m opened 5 years ago

guillev2m commented 5 years ago

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 commented 10 months ago

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

guillev2m commented 10 months ago

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