2019独角兽企业重金招聘Python工程师标准>>>
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