Does Android use OkHttp internally?

2019-01-17 20:45发布

This is a stack trace I get when running an Android app I recently inherited. We're not using OkHttp as an explicitly dependency, and the com.android.okhttp in the trace makes me think the AOSP is using OkHttp now internally?

java.lang.Throwable: Explicit termination method 'close' not called
E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
E      at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:278)
E      at com.android.okhttp.Connection.upgradeToTls(Connection.java:146)
E      at com.android.okhttp.Connection.connect(Connection.java:107)
E      at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
E      at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
E      at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
E      at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
E      at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
E      at com.android.okhttp.internal.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:143)
E      at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:544)
E      at java.net.URLConnection.getContentLength(URLConnection.java:316)
E      at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getContentLength(HttpsURLConnectionImpl.java:182)

1条回答
劳资没心,怎么记你
2楼-- · 2019-01-17 21:14

Yes, Android as of Android 4.4 is using OkHttp for its internal HttpUrlConnection implementation.

查看更多
登录 后发表回答