Android - http连接java.net.UnknownHostException错误:

时间:2012-05-21 11:39:56

标签: android json http

我试图连接mysql与android但它给我一个错误。 http连接java.net.UnknownHostException错误:

以下是我的代码:

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.pherma.net84.net/admin/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();

但是网址运行正常。请复制n粘贴网址。

1 个答案:

答案 0 :(得分:4)

我忘记将清单中的网络权限。现在工作正常。