Crash in OkHttpClientTransport
See original GitHub issueWhat version of gRPC-Java are you using?
1.32.2
What is your environment?
android
What did you expect to see?
The library should instantiate
What did you see instead?
The library crashes with the following stack-trace:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/HttpUrl$Builder;
at io.grpc.okhttp.OkHttpClientTransport.createHttpProxyRequest(OkHttpClientTransport.java:711)
at io.grpc.okhttp.OkHttpClientTransport.createHttpProxySocket(OkHttpClientTransport.java:663)
at io.grpc.okhttp.OkHttpClientTransport.access$000(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$302(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$702(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1100(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1502(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1600(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1702(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1802(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$2200(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$2702(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport$4.run(OkHttpClientTransport.java:559)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
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:919)
Caused by: java.lang.ClassNotFoundException: com.squareup.okhttp.HttpUrl$Builder
at io.grpc.okhttp.OkHttpClientTransport.createHttpProxyRequest(OkHttpClientTransport.java:711)
at io.grpc.okhttp.OkHttpClientTransport.createHttpProxySocket(OkHttpClientTransport.java:663)
at io.grpc.okhttp.OkHttpClientTransport.access$000(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$302(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$702(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1100(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1502(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1600(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1702(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$1802(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$2200(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport.access$2702(OkHttpClientTransport.java:109)
at io.grpc.okhttp.OkHttpClientTransport$4.run(OkHttpClientTransport.java:559)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
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:919)
Steps to reproduce the bug
Not fully reproducible but happening on Android 10/11 and mostly on Xiaomi/Realme
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Libgdx IOS app with RoboVM crash because of okhttp
I am trying to use Grpc in my libgdx app. Grpc uses okhttp to make network calls. Its working perfectly fine in android, ......
Read more >Hundreds of grpc-okttp-* threads spawn - Google Groups
I am trying to solve out of memory crashes I have on my project. ... OkHttpClientTransport$4.run (OkHttpClientTransport.java:574).
Read more >Index (CometD :: Java 5.0.14 API)
OkHttpClientTransport · abort(Throwable) - Method in class ... for example because the correspondent node has been shut down or crashed.
Read more >Crash on okhttp3 client after updating Android app to v6.3.1
Hi there, After updating to v6.3.1 in Android, the app crashes on okhttp3 client: LOCATION Cache.java line 233 in `okhttp3.
Read more >Diff - platform/external/grpc-grpc-java - Google Git
MAX_VALUE)); - final Credentials credentials = GoogleCredentials.create(token); - // Null should not (for the moment) crash in horrible ways.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you are right. we are not bundling okhttp2 which is required by grpc-okhttp. added it and the crash is resolved. Thanks for all your help 😃
Thanks for confirming. Could you double check your setup then? Is this possible that you excluded the okhttp dependency from grpc-okhttp thinking it wasn’t necessary?