question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash in OkHttpClientTransport

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bangarharshitcommented, Nov 15, 2021

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 😃

1reaction
sergiitkcommented, Nov 12, 2021

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found