我试图连接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粘贴网址。
答案 0 :(得分:4)
我忘记将清单中的网络权限。现在工作正常。