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

标签 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();

但是 URL 工作正常。请复制并粘贴网址。

最佳答案

我忘记将网络权限放入 list 中。现在工作正常。

关于Android - http 连接错误 java.net.UnknownHostException :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10684543/

相关文章:

android - 此线程禁止 HTTP 请求

Android 在 BT 连接上强行杀死我的启动器

python - 如何使用 Python 抓取类别维基百科页面类别中的子类别和页面

javascript - axios head 请求出现 403 错误

android - 在 Android 中显示 YUV 图像

android - android中的连接组件标签

python - 将 JSON 呈现为 Python 中的目录结构

php - JQuery.ajax 和对象和 php 的空响应

http - 有没有办法使用 HTTP 允许服务器在客户端浏览器中更新内容而无需客户端请求?

linux - 与 ngrok 相关的错误