加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 执行httpclient时出现奇怪的错误

发布时间:2020-12-15 00:35:02 所属栏目:Java 来源:网络整理
导读:I have created an http request in my project. I sat it but didn’t work so simplified that part to test it: This is it: HttpClient cl = new DefaultHttpClient(); try { HttpResponse httpResponse = cl.execute(new HttpGet("http://www.google.co

I have created an http request in my project. I sat it but didn’t work
so simplified that part to test it: This is it:

HttpClient cl = new DefaultHttpClient();
    try {
        HttpResponse httpResponse = cl.execute(new HttpGet("http://www.google.com"));
        System.out.println(httpResponse.getEntity().getContentLength());
    }
    catch (Exception e)
    {
        System.out.println("didn't work!");
        System.out.println(e.getMessage());
    }

但是当我运行它时我会得到这些:

07-21 15:57:36.203  26851-26851/com.akgradev.upbman W/﹕ Unable to open '/system/framework/qcom.fmradio.jar': No such file or directory
07-21 15:57:36.203  26851-26851/com.akgradev.upbman W/art﹕ Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error

And of course a “Didn’t work!” and a “null” for prints! I appreciate
your tips Tnx

解决方法

你知道HttpClient被弃用了吗?

https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

您的例外可能是API不再受支持的结果.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读