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

AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher #27250

Closed
Elderkly opened this issue Nov 18, 2019 · 9 comments
Closed

AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher #27250

Elderkly opened this issue Nov 18, 2019 · 9 comments
Labels
Bug 🌐Networking Related to a networking API. Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@Elderkly
Copy link

E AndroidRuntime: java.lang.NoSuchMethodError: No virtual method toString(Z)Ljava/lang/String; in class Lokhttp3/Cookie; or its super classes (declaration of 'okhttp3.Cookie' appears in /data/app/com.piglet-VoaKTU4zctXOlMHherGcyg==/base.apk!classes2.dex)
E AndroidRuntime: at okhttp3.JavaNetCookieJar.saveFromResponse(JavaNetCookieJar.java:45)
E AndroidRuntime: at com.facebook.react.modules.network.ReactCookieJarContainer.saveFromResponse(ReactCookieJarContainer.java:36)
E AndroidRuntime: at okhttp3.internal.http.HttpHeaders.receiveHeaders(HttpHeaders.kt:207)
E AndroidRuntime: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:86)
E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
E AndroidRuntime: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:71)
E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
E AndroidRuntime: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
E AndroidRuntime: at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)

React Native version:
System:
OS: macOS Mojave 10.14.6
CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
Memory: 22.18 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 21, 23, 24, 25, 26, 27, 28, 29
Build Tools: 25.0.2, 25.0.3, 28.0.3, 29.0.0, 29.0.2
System Images: android-21 | Android TV ARM EABI v7a, android-21 | Android TV Intel x86 Atom, android-21 | ARM EABI v7a, android-21 | Intel x86 Atom, android-21 | Intel x86 Atom_64, android-21 | Google APIs ARM EABI v7a, android-21 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom_64, android-23 | Android TV ARM EABI v7a, android-23 | Android TV Intel x86 Atom, android-23 | Android Wear ARM EABI v7a, android-23 | Android Wear Intel x86 Atom, android-23 | ARM EABI v7a, android-23 | Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-24 | Android TV Intel x86 Atom, android-24 | ARM 64 v8a, android-24 | ARM EABI v7a, android-24 | Intel x86 Atom, android-24 | Intel x86 Atom_64, android-24 | Google APIs ARM 64 v8a, android-24 | Google APIs ARM EABI v7a, android-24 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-26 | Android TV Intel x86 Atom, android-26 | China version of Android Wear Intel x86 Atom, android-26 | Android Wear Intel x86 Atom, android-26 | Intel x86 Atom, android-26 | Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-Q | Android TV Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.2/11B52 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.1 => 0.61.1
npmGlobalPackages:
react-native-asset: 2.0.0
react-native-cli: 2.0.1
react-native-update-cli: 0.1.0

@Elderkly Elderkly added the Bug label Nov 18, 2019
@react-native-bot react-native-bot added Platform: Android Android applications. 🌐Networking Related to a networking API. labels Nov 18, 2019
@JeffKGabriel
Copy link

JeffKGabriel commented Dec 4, 2019

same runtime error here - build is fine

My android technical knowledge is still a bit limited - but from what i can research
square/okhttp#5425 -> leaves me to believe it is caused by different version numbers in the okhttp dependency

my fix to get the build to stop crashing during runtime was to include these in my android/app/build.gradle

    compile "com.squareup.okhttp3:okhttp:4.2.1"
    compile "com.squareup.okhttp3:logging-interceptor:4.2.1"
    compile "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"

i assume the correct fix is to find which added import from your project is causing the version discrepancy, but this overriding works for me temporarily

@Elderkly
Copy link
Author

Elderkly commented Dec 5, 2019

同样的运行时错误-构建很好

我的Android技术知识仍然有限-但据我
所知,square / okhttp#5425- >让我相信这是由okhttp依赖项中的不同版本号引起的

我要让构建在运行时停止崩溃的解决方法是将这些包含在我的android / app / build.gradle中

    compile "com.squareup.okhttp3:okhttp:4.2.1"
    compile "com.squareup.okhttp3:logging-interceptor:4.2.1"
    compile "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"

我认为正确的解决方法是找到从您的项目中添加的哪些导入导致版本差异,但是此替代对我暂时有效

thanks!

@Elderkly Elderkly closed this as completed Dec 6, 2019
@Mactub07
Copy link

have the same issue as well. @JeffKGabriel , could you create screenshot how I can paste your 'magic strings' into android/app/build.gradle

@JeffKGabriel
Copy link

JeffKGabriel commented Jan 10, 2020

apologies for the late response -
towards the end of the file - there is an existing section for dependencies

so including a implementation or compile would look like

dependencies {
     compile "com.squareup.okhttp3:okhttp:4.2.1"
     compile "com.squareup.okhttp3:logging-interceptor:4.2.1"
     compile "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"
}

@happysingh23828
Copy link

Thanks @JeffKGabriel It's solves the problem.

@MaheshNandam
Copy link

apologies for the late response -
towards the end of the file - there is an existing section for dependencies

so including a implementation or compile would look like

dependencies {
     compile "com.squareup.okhttp3:okhttp:4.2.1"
     compile "com.squareup.okhttp3:logging-interceptor:4.2.1"
     compile "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"
}

Thanks @JeffKGabriel ,

Few lines about my findings,

Actually, my app got crashed in android device with API response as 'SKIPPED' in reactotron log,
I tried to track with android studio and found FATAL EXCEPTION: OkHttp Dispatcher and issue solved with these above lines.

@mariod3w
Copy link

mariod3w commented Aug 8, 2020

apologies for the late response -
towards the end of the file - there is an existing section for dependencies

so including a implementation or compile would look like

dependencies {
     compile "com.squareup.okhttp3:okhttp:4.2.1"
     compile "com.squareup.okhttp3:logging-interceptor:4.2.1"
     compile "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"
}

Thanks!
I was all day trying to solve this problem, you saved me.

@alkalox
Copy link

alkalox commented Oct 13, 2020

I have been getting this error, which I fixed using @JeffKGabriel 's comment, but on publishing the app to the Play Store I get a TrustManager vulnerability warning from Google Play.

Any clues, anyone?

Edit: The issue was an insecure implementation of TrustManager in a Native Android SDK I had integrated.

@MoOx
Copy link
Contributor

MoOx commented Jan 4, 2021

I had this issue while doing a fetch() call using Authorisation headers.
The dependencies listed in this issue are working for Android 10, but not 6.
After a quick search, it seems that this is enough and cover 6 to 10:

    implementation "com.squareup.okhttp3:okhttp"
    implementation "com.squareup.okhttp3:okhttp-bom:4.4.1"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 🌐Networking Related to a networking API. Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

9 participants