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

Incompatibility with okhttp3 version >= 3.12.0 #155

Open
3dteemu opened this issue Sep 27, 2019 · 2 comments
Open

Incompatibility with okhttp3 version >= 3.12.0 #155

3dteemu opened this issue Sep 27, 2019 · 2 comments

Comments

@3dteemu
Copy link

3dteemu commented Sep 27, 2019

The library uses internal parts of OkHttp3, namely
com.ibm.mobilefirstplatform.clientsdk.android.core.internal.ResponseImpl (34): import static okhttp3.internal.Util.UTF_8;
Using OkHttp3 internals is not a good practice. This was removed from OkHttp3 at version 3.12.0, which breaks appid-clientsdk-android.

    Process: xx.xx.xx.xxxxx, PID: 10131
    java.lang.NoSuchFieldError: No static field UTF_8 of type Ljava/nio/charset/Charset; in class Lokhttp3/internal/Util; or its superclasses (declaration of 'okhttp3.internal.Util' appears in /data/app/xx.xx.xx.xxxxx-tswAk9-LRJ0XKWEJ3xxt9w==/base.apk!classes3.dex)
        at com.ibm.mobilefirstplatform.clientsdk.android.core.internal.ResponseImpl.getResponseText(ResponseImpl.java:120)
        at com.ibm.cloud.appid.android.internal.tokenmanager.TokenManager.extractTokens(TokenManager.java:216)
        at com.ibm.cloud.appid.android.internal.tokenmanager.TokenManager$1.onSuccess(TokenManager.java:166)
        at com.ibm.mobilefirstplatform.clientsdk.android.core.internal.BaseRequest$2.onResponse(BaseRequest.java:771)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
@rotembr
Copy link
Contributor

rotembr commented Oct 3, 2019

Hi
Thanks for pointing it out.
The ResponseImpl.java belongs to "com.ibm.mobilefirstplatform.clientsdk.android.core" module.
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core
I opened a ticket in this repo with that info, once they address it we could upgrade the SDK version and use it.
ibm-bluemix-mobile-services/bms-clientsdk-android-core#70

*BTW I tried to use the SDK with OkHttp 3.12.0 and everything worked.
I notice that the removal of the UTF_8 was on 3.13.0..

Thanks

@RogerSnook
Copy link

RogerSnook commented Dec 22, 2021

@rotembr - you mentioned " I tried to use the SDK with OkHttp 3.12.0 and everything worked."

I too was finally able to get this working with TWO parts:

  1. Backleveling the okhttp3 dependency with the following gradle file modification. Fortunately, Cloudant didn't seem to be affected by this as it also uses okhttp3.

// AppID has an issue - an internal okhttp3 call that went away in okhttp3 3.13 so - have to FORCE
// backleveling this until the AppID service gets updated
// https://docs.gradle.org/7.0.2/userguide/dependency_downgrade_and_exclude.html#sec:enforcing_dependency_version
configurations.all {
resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.12.1'
resolutionStrategy.force 'com.squareup.okhttp3:okhttp-urlconnection:3.12.1'
}

  1. Ensuring to use Android Studio's File -> Invalidate Caches/Restart menu option (AFTER the above changes). This ensured all the dependencies were rebuilt.

I still wish that whatever code change was made in AppID back in April 2020 that it gets included here ibm-bluemix-mobile-services/bms-clientsdk-android-core#70 but I'm not seeing that.

Oddly - on my emulator, I have to force run chrome FIRST before the LaunchWidget is able to open. This clearly is a corner case, but probably should be investigated.

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

3 participants