since release 4.7.0 and also for 4.7.1 i get the following exception when using the OkHttpClient.
2020-05-19 13:15:39.061 13971-14060/fr.gaulupeau.apps.InThePoche.debug E/ArticleUpdateWorker: updateArticles() exception
java.lang.IllegalArgumentException: Not a Conscrypt trust manager: android.security.net.config.RootTrustManager
at org.conscrypt.Conscrypt.toConscrypt(Conscrypt.java:736)
at org.conscrypt.Conscrypt.setHostnameVerifier(Conscrypt.java:769)
at okhttp3.internal.platform.ConscryptPlatform.platformTrustManager(ConscryptPlatform.kt:53)
at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:237)
at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:1069)
at fr.gaulupeau.apps.Poche.network.WallabagConnection.createClient(WallabagConnection.java:123)
at fr.gaulupeau.apps.Poche.network.WallabagConnection.createWallabagService(WallabagConnection.java:107)
at fr.gaulupeau.apps.Poche.network.WallabagConnection.getWallabagService(WallabagConnection.java:38)
at fr.gaulupeau.apps.Poche.service.workers.BaseNetworkWorker.getWallabagService(BaseNetworkWorker.java:86)
at fr.gaulupeau.apps.Poche.service.workers.ArticleUpdateWorker.updateArticles(ArticleUpdateWorker.java:76)
at fr.gaulupeau.apps.Poche.service.workers.ArticleUpdateWorker.update(ArticleUpdateWorker.java:37)
at fr.gaulupeau.apps.Poche.service.tasks.UpdateArticlesTask.run(UpdateArticlesTask.java:17)
at fr.gaulupeau.apps.Poche.service.tasks.ActionRequestTask.run(ActionRequestTask.java:25)
at fr.gaulupeau.apps.Poche.service.-$$Lambda$Eg7UQkyPgCNRHvigqxzb-ridugA.run(Unknown Source:2)
at fr.gaulupeau.apps.Poche.service.TaskService.run(TaskService.java:158)
at fr.gaulupeau.apps.Poche.service.TaskService.lambda$gjfracnqY8x0_-mrxsx0oqjQmgk(Unknown Source:0)
at fr.gaulupeau.apps.Poche.service.-$$Lambda$TaskService$gjfracnqY8x0_-mrxsx0oqjQmgk.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:919)
We create the client like this (simplified from here):
OkHttpClient.Builder b = new OkHttpClient.Builder()
.readTimeout(45, TimeUnit.SECONDS);
b.build();
This issue does not occur with release 4.6.0 or 4.5.0.
Is this a bug? Or do you have an idea how i can fix this exception?
Some additional info: the project is an Android application which uses the Conscrypt library.
Minimal case:
implementation 'org.conscrypt:conscrypt-android:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:4.7.1'
Security.insertProviderAt(Conscrypt.newProvider(), 1);
new OkHttpClient();
Our 4.x Android tests use Security.insertProviderAt(Conscrypt.newProviderBuilder().build(), 1)
https://github.com/square/okhttp/blob/master/android-test/build.gradle#L50
The core issue here is the Platform check seems to be failing and we are trying to use Conscrypt JVM provider on Android.
Just found the env details on the linked bug, thanks.
wallabag app version: master f37abc7
wallabag app installation source (e.g. Gplay, F-Droid, manual): manual
Android OS version: 10
Android ROM (e.g. stock, LineageOS, SlimRom,…): stock
Android hardware: Samsung S9
wallabag server version: 2.3.8
Do you have Two-Factor-Authentication enabled?: no
This project provides a trivial repro of the issue. It's a bug with the initialisation ordering of the fields of companion classes. My bad.
https://github.com/wallabag/android-app

Released in 4.7.2.
https://square.github.io/okhttp/changelog/#version-472