DefaultHttpClient 在oppo A57手机上网络请求报错
Posted lucktian
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DefaultHttpClient 在oppo A57手机上网络请求报错相关的知识,希望对你有一定的参考价值。
使用的库是xutils2.6.14,oppo A57 上调试的时候,请求接口时报错,但是其他手机都正常;
com.lidroid.xutils.exception.HttpException:
java.io.IOException: Attempt to invoke virtual method ‘boolean java.lang.String.contains(java.lang.CharSequence)‘ on a null object reference
接入xutils2.6.14源码库查看报错是:
06-11 11:37:20.792 W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean java.lang.String.contains(java.lang.CharSequence)‘ on a null object reference
06-11 11:37:20.794 W/System.err: at org.apache.http.protocol.RequestUserAgent.process(RequestUserAgent.java:83)
06-11 11:37:20.794 W/System.err: at org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:295)
06-11 11:37:20.794 W/System.err: at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:165)
06-11 11:37:20.794 W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:418)
06-11 11:37:20.794 W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)
06-11 11:37:20.795 W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:492)
06-11 11:37:20.795 W/System.err: at com.lidroid.xutils.http.HttpHandler.sendRequest(HttpHandler.java:125)
06-11 11:37:20.795 W/System.err: at com.lidroid.xutils.http.HttpHandler.doInBackground(HttpHandler.java:181)
06-11 11:37:20.795 W/System.err: at com.lidroid.xutils.http.HttpHandler.doInBackground(HttpHandler.java:40)
06-11 11:37:20.795 W/System.err: at com.lidroid.xutils.task.PriorityAsyncTask$1.call(PriorityAsyncTask.java:67)
06-11 11:37:20.795 W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-11 11:37:20.795 W/System.err: at com.lidroid.xutils.task.PriorityRunnable.run(PriorityRunnable.java:16)
06-11 11:37:20.795 W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-11 11:37:20.795 W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-11 11:37:20.795 W/System.err: at java.lang.Thread.run(Thread.java:818)
以上是关于DefaultHttpClient 在oppo A57手机上网络请求报错的主要内容,如果未能解决你的问题,请参考以下文章
DefaultHttpClient 类 Android 中的超时
Android 上 DefaultHttpClient 中连接和套接字超时的默认值是啥?