【发布时间】:2021-04-20 14:10:05
【问题描述】:
我使用 vimeo 网络库 (https://github.com/vimeo/vimeo-networking-java)、exoplayer 实现了 vimeo 网络,并在这篇文章中解释了 https://stackoverflow.com/a/65737556/8814924
现在的问题是,当我使用 API 30 检查时出现错误
java.lang.RuntimeException: Unable to start Activity ComponentInfo{com.emergingit.emergingstudy/com.emergingit.emergingstudy.activities.course.ExoPlayerActivity}: java.lang.IllegalStateException: Unable to extract the trust manager on Android10Platform, sslSocketFactory是类 com.android.org.conscrypt.OpenSSLSocketFactoryImpl
原因:java.lang.IllegalStateException: Unable to extract the trust manager on Android10Platform, sslSocketFactory is class com.android.org.conscrypt.OpenSSLSocketFactoryImpl
表示错误
VimeoClient.initialize(configuration);
这里讨论了哪个问题:https://github.com/square/okhttp/issues/5878,问题讨论:
I assume you are calling the deprecated form of sslSocketFactory, which is broken on newer Android versions. https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/OkHttpClient.kt#L719
/**
* Sets the socket factory used to secure HTTPS connections. If unset, the system default will
* be used.
*
* @deprecated [SSLSocketFactory] does not expose its [X509TrustManager], which is a field that
* OkHttp needs to build a clean certificate chain. This method instead must use reflection
* to extract the trust manager. Applications should prefer to call
* `sslSocketFactory(SSLSocketFactory, X509TrustManager)`, which avoids such reflection.
*/
@Deprecated(
message = "Use the sslSocketFactory overload that accepts a X509TrustManager.",
level = DeprecationLevel.ERROR
)
fun sslSocketFactory(sslSocketFactory: SSLSocketFactory) = apply {
if (sslSocketFactory != this.sslSocketFactoryOrNull) {
this.routeDatabase = null
}
this.sslSocketFactoryOrNull = sslSocketFactory
this.certificateChainCleaner = Platform.get().buildCertificateChainCleaner(sslSocketFactory)
}
使用当前版本的“1.1.3”网络库是否有任何解决方案,或者我必须等到库更新?
【问题讨论】:
标签: runtime-error android-10.0 sslsocketfactory vimeo-android trustmanager