错误Transport.writeRequestHeaders导致空指针(NullPointerException)错误的说明

飞翔的蜗牛 4个月前 154次点击 来自 Android

java.lang.NullPointerException: Attempt to invoke interface method 'void com.android.okhttp.internal.http.Transport.writeRequestHeaders(com.android.okhttp.Request)' on a null object reference
 at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:789)
 at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:460)
 at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405)
 at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:518)
 at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
 at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
 at cn.magicwindow.common.http.ai.e(SourceFile:335)
 at cn.magicwindow.common.http.ai.d(SourceFile:290)
 at cn.magicwindow.common.http.ai.f(SourceFile:392)
 at cn.magicwindow.common.http.z.a(SourceFile:105)
 at cn.magicwindow.common.http.z.run(SourceFile:60)

有时候我们从第三方检测平台上可以发现上述bug。
经过排查,这个是Android内置的OkHttp模块老版本(okhttp2)的一个bug。
Google后续已更新没有此问题.
遇到此问题时,错误信息会在网络回调的onError内显示,不会导致程序崩溃。

目前暂无回复

魔窗, 移动互联网生态领导者