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.

OkHttp 4.3.1 spams log, didn't find class "org.conscrypt.ConscryptHostnameVerifier" on path

See original GitHub issue

A trivial use of OkHttp 4.3.1 causes some spam in the device log.

https://gist.github.com/jamesonwilliams/8ab7237083467ed3cb8680115a3e3829

This code:

Disposable disposable = Single.fromCallable(() ->
    new OkHttpClient().newCall(new Request.Builder()
        .url("https://raw.githubusercontent.com/square/okhttp/master/README.md")
        .get()
        .build())
    .execute()
    .body()
    .string()
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
    textView::setText,
    failure -> textView.setText(Log.getStackTraceString(failure))
);

With this OkHttp:

implementation 'com.squareup.okhttp3:okhttp:4.3.1'

Causes this spam, as the out-of-the-box default:

I: Rejecting re-init on previously-failed class java.lang.Class<okhttp3.internal.platform.ConscryptPlatform$configureTrustManager$1>: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/conscrypt/ConscryptHostnameVerifier;
I:     at okhttp3.internal.platform.android.SocketAdapter okhttp3.internal.platform.android.ConscryptSocketAdapter$Companion.buildIfSupported() (ConscryptSocketAdapter.kt:62)
I:     at void okhttp3.internal.platform.AndroidPlatform.<init>() (AndroidPlatform.kt:44)
I:     at okhttp3.internal.platform.Platform okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported() (AndroidPlatform.kt:212)
I:     at okhttp3.internal.platform.Platform okhttp3.internal.platform.Platform$Companion.findPlatform() (Platform.kt:207)
I:     at okhttp3.internal.platform.Platform okhttp3.internal.platform.Platform$Companion.access$findPlatform(okhttp3.internal.platform.Platform$Companion) (Platform.kt:169)
I:     at void okhttp3.internal.platform.Platform.<clinit>() (Platform.kt:170)
I:     at void okhttp3.OkHttpClient.<init>(okhttp3.OkHttpClient$Builder) (OkHttpClient.kt:220)
I:     at void okhttp3.OkHttpClient.<init>() (OkHttpClient.kt:212)
I:     at java.lang.String okhttp.conscrypt.issue.MainActivity.lambda$onCreate$0() (MainActivity.java:28)
I:     at java.lang.Object okhttp.conscrypt.issue.-$$Lambda$MainActivity$HFmP7xhC1oUdC6d5U0mKIdLTGns.call() (lambda:-1)
I:     at void io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(io.reactivex.SingleObserver) (SingleFromCallable.java:44)
I:     at void io.reactivex.Single.subscribe(io.reactivex.SingleObserver) (Single.java:3666)
I:     at void io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run() (SingleSubscribeOn.java:89)
I:     at void io.reactivex.Scheduler$DisposeTask.run() (Scheduler.java:578)
I:     at void io.reactivex.internal.schedulers.ScheduledRunnable.run() (ScheduledRunnable.java:66)
I:     at java.lang.Object io.reactivex.internal.schedulers.ScheduledRunnable.call() (ScheduledRunnable.java:57)
I:     at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
I:     at void java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run() (ScheduledThreadPoolExecutor.java:272)
I:     at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
I:     at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
I:     at void java.lang.Thread.run() (Thread.java:761)
I: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.conscrypt.ConscryptHostnameVerifier" on path: DexPathList[[zip file "/data/app/okhttp.conscrypt.issue-2/base.apk"],nativeLibraryDirectories=[/data/app/okhttp.conscrypt.issue-2/lib/x86, /system/lib, /vendor/lib]]
I:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
I:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
I:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I:     at okhttp3.internal.platform.android.SocketAdapter okhttp3.internal.platform.android.ConscryptSocketAdapter$Companion.buildIfSupported() (ConscryptSocketAdapter.kt:62)
I:     at void okhttp3.internal.platform.AndroidPlatform.<init>() (AndroidPlatform.kt:44)
I:     at okhttp3.internal.platform.Platform okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported() (AndroidPlatform.kt:212)
I:     at okhttp3.internal.platform.Platform okhttp3.internal.platform.Platform$Companion.findPlatform() (Platform.kt:207)
I:     at okhttp3.internal.platform.Platform okhttp3.internal.platform.Platform$Companion.access$findPlatform(okhttp3.internal.platform.Platform$Companion) (Platform.kt:169)
I:     at void okhttp3.internal.platform.Platform.<clinit>() (Platform.kt:170)
I:     at void okhttp3.OkHttpClient.<init>(okhttp3.OkHttpClient$Builder) (OkHttpClient.kt:220)
I:     at void okhttp3.OkHttpClient.<init>() (OkHttpClient.kt:212)
I:     at java.lang.String okhttp.conscrypt.issue.MainActivity.lambda$onCreate$0() (MainActivity.java:28)
I:     at java.lang.Object okhttp.conscrypt.issue.-$$Lambda$MainActivity$HFmP7xhC1oUdC6d5U0mKIdLTGns.call() (lambda:-1)
I:     at void io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(io.reactivex.SingleObserver) (SingleFromCallable.java:44)
I:     at void io.reactivex.Single.subscribe(io.reactivex.SingleObserver) (Single.java:3666)
I:     at void io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run() (SingleSubscribeOn.java:89)
I:     at void io.reactivex.Scheduler$DisposeTask.run() (Scheduler.java:578)
I:     at void io.reactivex.internal.schedulers.ScheduledRunnable.run() (ScheduledRunnable.java:66)
I:     at java.lang.Object io.reactivex.internal.schedulers.ScheduledRunnable.call() (ScheduledRunnable.java:57)
I:     at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
I:     at void java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run() (ScheduledThreadPoolExecutor.java:272)
I:     at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
I:     at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
I:     at void java.lang.Thread.run() (Thread.java:761)

I am not using Conscrypt. I do not include it in my Android project’s Gradle dependencies. I do agree with the view point of this StackOverflow comment from kroegerama@:

If okHttp needs conscrypt, it should reference this library instead of forcing us to add this dependency. This should not be marked as accepted. Better file a bug report on square’s github repo. – kroegerama Nov 7 '19 at 14:07

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:21
  • Comments:24 (1 by maintainers)

github_iconTop GitHub Comments

28reactions
fnuttenscommented, Sep 3, 2020

Hi! I just noticed that the error keeps occurring with OkHttp 4.8.1, along with other missing classes from bouncycastle, openjsse and android:

okhttp3.internal.platform.ConscryptPlatform$platformTrustManager$2: can't find superclass or interface org.conscrypt.ConscryptHostnameVerifier
okhttp3.internal.io.FileSystem$Companion$SYSTEM$1: can't find referenced class okhttp3.internal.io.FileSystem$DefaultImpls
okhttp3.internal.platform.BouncyCastlePlatform: can't find referenced class org.bouncycastle.jsse.BCSSLSocket
okhttp3.internal.platform.BouncyCastlePlatform: can't find referenced class org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
okhttp3.internal.platform.BouncyCastlePlatform: can't find referenced class org.bouncycastle.jsse.BCSSLParameters
okhttp3.internal.platform.ConscryptPlatform: can't find referenced class org.conscrypt.ConscryptHostnameVerifier
okhttp3.internal.platform.ConscryptPlatform: can't find referenced class org.conscrypt.Conscrypt
okhttp3.internal.platform.ConscryptPlatform$Companion: can't find referenced class org.conscrypt.Conscrypt
okhttp3.internal.platform.ConscryptPlatform$platformTrustManager$2: can't find referenced class org.conscrypt.ConscryptHostnameVerifier
okhttp3.internal.platform.Jdk9Platform: can't find referenced method 'void setApplicationProtocols(java.lang.String[])' in library class javax.net.ssl.SSLParameters
okhttp3.internal.platform.Jdk9Platform: can't find referenced method 'java.lang.String getApplicationProtocol()' in library class javax.net.ssl.SSLSocket
okhttp3.internal.platform.OpenJSSEPlatform: can't find referenced class org.openjsse.javax.net.ssl.SSLParameters
okhttp3.internal.platform.OpenJSSEPlatform: can't find referenced class org.openjsse.javax.net.ssl.SSLSocket
okhttp3.internal.platform.OpenJSSEPlatform: can't find referenced class org.openjsse.net.ssl.OpenJSSE
okhttp3.internal.platform.android.Android10SocketAdapter: can't find referenced method 'java.lang.String getApplicationProtocol()' in library class javax.net.ssl.SSLSocket
okhttp3.internal.platform.android.Android10SocketAdapter: can't find referenced class android.net.ssl.SSLSockets
okhttp3.internal.platform.android.Android10SocketAdapter: can't find referenced method 'void setApplicationProtocols(java.lang.String[])' in library class javax.net.ssl.SSLParameters
okhttp3.internal.platform.android.BouncyCastleSocketAdapter: can't find referenced class org.bouncycastle.jsse.BCSSLParameters
okhttp3.internal.platform.android.BouncyCastleSocketAdapter: can't find referenced class org.bouncycastle.jsse.BCSSLSocket
okhttp3.internal.platform.android.BouncyCastleSocketAdapter$Companion$factory$1: can't find referenced class org.bouncycastle.jsse.BCSSLSocket
okhttp3.internal.platform.android.ConscryptSocketAdapter: can't find referenced class org.conscrypt.Conscrypt
okhttp3.internal.platform.android.ConscryptSocketAdapter$Companion$factory$1: can't find referenced class org.conscrypt.Conscrypt

Have we got any update on this bug?

12reactions
AndroidVironitDevelopercommented, May 28, 2020

Hi! Noticed the same logs for

versionRetrofit = ‘2.9.0’ versionOkHttp = ‘4.7.2’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rejecting re-init on previously-failed class in OkHttp
While reading the info message, it gives me an idea about this Conscrypt and did a research and found out that I need...
Read more >
【okhttp3+Kotlin】Rejecting re-init on previously-failed class ...
OkHttp 4.3.1 spams log, didn't find class “org.conscrypt.ConscryptHostnameVerifier” on path #5760. 2020/05/28 更新:BugのLabelがついている。
Read more >
3.x Change Log - OkHttp
Fix: Don't crash when running as a plugin in Android Studio Canary 4.1. To enable platform-specific TLS features OkHttp must detect whether it's...
Read more >
windows 10 system,check out error,filename is too long - Java ...
Secure. Instantly Familiar. - ClassicPress · okhttp OkHttp 4.3.1 spams log, didn't find class "org.conscrypt.ConscryptHostnameVerifier" on path - Kotlin ...
Read more >
OkHttp 4.3.1 spams log, didn't find class "org.conscrypt ...
Okhttp : OkHttp 4.3.1 spams log, didn't find class "org.conscrypt.ConscryptHostnameVerifier" on path. Created on 30 Jan 2020 · 21Comments · Source: square/ ...
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