1. org.apache.http.conn.HttpHostConnectException: Connection to refused
权限问题:
<uses-permission android:name="android.permission.INTERNET"/>
2. 浏览器直接输入url可以get,http get失败
在Activity(调用HttpClient处),也可能是Fragment,中添加
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);
详情可参考
http://stackoverflow.com/questions/14399892/android-cant-execute-http-get-or-post-request
时间: 2024-11-13 09:28:01