java.io.IOException: Target host must not be null, or set in parameters. scheme=null, host=null, …

Xutils used

An error occurred in the title

Reason: no cookie was added

1 params.addHeader("Cookie", CurrentUserSettings.getCookies());

After that, the problem will be solved

Cookies are obtained by

final HttpUtils httpUtils = new HttpUtils();
        params.setPriority(Priority.BG_TOP);
        httpUtils.send(HttpRequest.HttpMethod.POST, url, params, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

                DefaultHttpClient defaultHttpClient = (DefaultHttpClient) httpUtils.getHttpClient();
                List<Cookie> cookies = defaultHttpClient.getCookieStore().getCookies();
    
                if (cookies.size() > 0) {

                    CurrentUserSettings.setCookies(cookies.get(0).getName() + "=" + cookies.get(0).getValue());
                }

             
            }
}

Similar Posts: