简体   繁体   中英

Strange error when execute httpclient

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());
    }

But when I run it I get these:

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

Are you aware of HttpClient being deprecated?

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

Your exceptions may be the result of the API no longer being supported.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM