我收到了UnknownHostException的错误。
try{
httpParameters = new BasicHttpParams();
String auth = android.util.Base64.encodeToString((params[0] + ":" + params[1]).getBytes("UTF-8"),Base64.NO_WRAP);
HttpGet request = new HttpGet("my.url");
request.addHeader("Authorization", "Basic " + auth);
request.addHeader("Accept","application/json");
client = new DefaultHttpClient(httpParameters);
/*in the next line is when the exception is launched*/
response = client.execute(request);
userAuth = EntityUtils.toString(response.getEntity());
return true;
}
catch (Exception e){
return false;
}
我还在AndroidManifest.xml中提供了Internet权限
有关如何解决问题的想法吗?