OkHttp android 5 崩溃 adcolony 和 helpshift
OkHttp android 5 crash adcolony and helpshift
仅在 android 5 上,一些第 3 方 sdk(adcolony 和 helpshift)随机崩溃(大部分时间是在应用程序刚启动时)。在下面的 android 5 中,两者都工作正常。
它们都在
上崩溃
com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:329)
com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:324)
Helpshift 崩溃堆栈跟踪:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:329)
com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:324)
com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116)
com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53)
com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:190)
com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
com.helpshift.support.HSApiClient.run(HSApiClient.java:318)
java.lang.Thread.run(Thread.java:818)
广告群崩溃堆栈跟踪:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:329)
com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:324)
com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116)
com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53)
com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:269)
com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106)
com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:208)
com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25)
com.jirbo.adcolony.ADCDownload.run(SourceFile:107)
at java.lang.Thread.run(Thread.java:818)
有人知道如何解决这个问题吗?
您提到的 NPE 似乎与在
android 5.0 的 okhttp 问题线程:http://code.google.com/p/android/issues/detail?id=160522
此问题的可能原因:
您可能正在使用自定义 ResponseCache/third 派对 ResponseCache,但它没有正确实现,并且 okhttp 没有正确处理空响应。
1.如果不需要响应缓存
此 NPE 的快速修复是 - 通过
禁用连接缓存
conn.setUseCaches(false)
2。如果您需要响应缓存
您使用的是哪种 ResponseCache 实现?是来自 android.net.http.HttpResponseCache 的 Android 还是第三方的?
自定义 ResponseCache 问题的根本原因
The root cause is that Android assumes that the status line (e.g. the
part of the response that indicates the response code, a message) is
held as the header with a null key. This is alluded to in the API
docs when you look at the header with the index of zero, but is not
explicit in the methods that return the Map, or that take a String
See here: http://developer.android.com/reference/java/net/CacheResponse.html#getHeaders()
从您提供的堆栈跟踪来看,问题似乎与使用自定义 ResponseCache 有关。
如果是这样,您可以在不需要时禁用缓存,否则您可以联系自定义响应缓存的维护者,如上面给出的 okhttp 问题的响应中所述。
如有任何其他与 Helpshift 相关的疑问,请随时通过 support@helpshift.com
与我们联系
仅在 android 5 上,一些第 3 方 sdk(adcolony 和 helpshift)随机崩溃(大部分时间是在应用程序刚启动时)。在下面的 android 5 中,两者都工作正常。
它们都在
上崩溃com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:329) com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:324)
Helpshift 崩溃堆栈跟踪:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:329) com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:324) com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116) com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53) com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:190) com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373) com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323) com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491) com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25) com.helpshift.support.HSApiClient.run(HSApiClient.java:318) java.lang.Thread.run(Thread.java:818)
广告群崩溃堆栈跟踪:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:329) com.android.okhttp.internal.http.JavaApiConverter.extractStatusLine(JavaApiConverter.java:324) com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116) com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53) com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:269) com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373) com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106) com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:208) com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218) com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25) com.jirbo.adcolony.ADCDownload.run(SourceFile:107) at java.lang.Thread.run(Thread.java:818)
有人知道如何解决这个问题吗?
您提到的 NPE 似乎与在 android 5.0 的 okhttp 问题线程:http://code.google.com/p/android/issues/detail?id=160522
此问题的可能原因:
您可能正在使用自定义 ResponseCache/third 派对 ResponseCache,但它没有正确实现,并且 okhttp 没有正确处理空响应。
1.如果不需要响应缓存
此 NPE 的快速修复是 - 通过
禁用连接缓存
conn.setUseCaches(false)
2。如果您需要响应缓存
您使用的是哪种 ResponseCache 实现?是来自 android.net.http.HttpResponseCache 的 Android 还是第三方的?
自定义 ResponseCache 问题的根本原因
The root cause is that Android assumes that the status line (e.g. the part of the response that indicates the response code, a message) is held as the header with a null key. This is alluded to in the API docs when you look at the header with the index of zero, but is not explicit in the methods that return the Map, or that take a String
See here: http://developer.android.com/reference/java/net/CacheResponse.html#getHeaders()
从您提供的堆栈跟踪来看,问题似乎与使用自定义 ResponseCache 有关。 如果是这样,您可以在不需要时禁用缓存,否则您可以联系自定义响应缓存的维护者,如上面给出的 okhttp 问题的响应中所述。
如有任何其他与 Helpshift 相关的疑问,请随时通过 support@helpshift.com
与我们联系