Android HTTP-post AsyncHttpClient

2019-07-21 05:18发布

问题:

public void postLoginData() {
    AsyncHttpClient myClient = new AsyncHttpClient();
    RequestParams params1 = new RequestParams();
    params1.put("username", "username");
    params1.put("password", "pass");
    myClient.post(
            "https://68.164.136.217/htdocs/?action=login&returntype=JSON", //"https://68.164.136.217/htdocs/?action=login", //"http://192.168.2.148/htdocs/?action=login&returntype=JSON",
            params1, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(String response) {
                    System.out.println("login success");
                }
            });
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    myClient.setCookieStore(myCookieStore);
    Log.d("Cookies", myCookieStore.getCookies().toString());
}

http://pastebin.com/htDhQpKT Log cat. I do not know why it is giving me this error. I have the internet permission

回答1:

The 3.0 kernel that runs Ice Cream Sandwich contains a netfilter module named xt_qtaguid. This process runs in the background and is responsible for processing the network usage for all PIDs and generating a stats log, located at /proc/net/xt_qtaguid/stats. This is probably because you missing this module in your kernel (probably more likely to occur if you are using the emulator... otherwise who knows why).

If you really care enough, it can be backported to the 2.6.35 kernel. Check this link out for more information. You may also want to consult this very similar SO post.