执行httpclient时出现奇怪的错误

时间:2015-07-21 11:39:17

标签: java android httprequest httpclient

  

我在项目中创建了一个http请求。我坐着但却没有工作   如此简化以测试它的部分:就是这样:

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
  

当然,"没有工作!"和" null"用于打印!我很感激   你的提示Tnx

1 个答案:

答案 0 :(得分:0)

您是否知道HttpClient已被弃用?

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

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