我试图将 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();
但是 URL 工作正常。请复制并粘贴网址。
最佳答案
我忘记将网络权限放入 list 中。现在工作正常。
关于Android - http 连接错误 java.net.UnknownHostException :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10684543/