无法解析主机“”没有与主机名关联的地址

发布于 2024-11-15 15:39:44 字数 1468 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

乖乖兔^ω^ 2024-11-22 15:39:44

您可能没有 INTERNET 权限。尝试将其添加到您的 AndroidManifest.xml 文件中,位于 之前:

<uses-permission android:name="android.permission.INTERNET" />

注意:上面的内容不一定是 em> 就在 标记之前,但这是放置它的好/正确的位置。

注意:如果这个答案对您的情况没有帮助,阅读其他答案!

You probably don't have the INTERNET permission. Try adding this to your AndroidManifest.xml file, right before </manifest>:

<uses-permission android:name="android.permission.INTERNET" />

Note: the above doesn't have to be right before the </manifest> tag, but that is a good / correct place to put it.

Note: if this answer doesn't help in your case, read the other answers!

泪意 2024-11-22 15:39:44

我在模拟器中也看到了这个问题。就我而言,这是由于启动模拟器,然后使计算机进入睡眠状态或更改网络连接(从工作地点到家等),然后尝试再次使用相同的模拟器而引起的。关闭并重新启动模拟器可以解决这种情况下的问题。

I've seen this problem in the emulator as well. In my case, it is caused by launching the emulator, then putting the computer to sleep or changing the network connection (going from work to home, etc), then attempting to use the same emulator again. Closing and re-launching the emulator resolves the problem in this case.

初熏 2024-11-22 15:39:44

这是由于 wifi 禁用或未正确连接而导致的 WiFi 错误

只需重新连接 wifi 即可解决问题。

It is WiFi bug due to wifi disable or not properly connected.

Simply Reconnect the wifi will solve the issue.

梦断已成空 2024-11-22 15:39:44

无法解析主机“”;没有与主机名关联的地址

您必须在清单上检查以下代码:

<uses-permission android:name="android.permission.INTERNET" />

至少对我来说最重要的是:-

在您的移动设备上启用 WiFi 连接或互联网连接

Unable to resolve host “”; No address associated with hostname

you must have to check below code here on your manifest :

<uses-permission android:name="android.permission.INTERNET" />

and most important at least for me:-

enabled wifi connection or internet connection on your mobile device

白首有我共你 2024-11-22 15:39:44

检查您是否拥有:

1- 可以访问互联网连接。

2- 清单中存在互联网许可。

3- url 主机有效并在受信任的域名服务器中注册。

Check you have:

1- Access to Internet connectivity.

2- The permission for internet is present in the manifest.

3- The url host is valid and registered in a trusted domain name server.

半城柳色半声笛 2024-11-22 15:39:44

有时,尽管您在 AndroidManifest 中添加 并且拥有 WiFi 连接,但仍可能引发此异常。就我而言,我关闭了 WiFi,然后再次打开。这解决了错误。奇怪的解决方案,但有时它有效。

Sometimes, although you add <uses-permission android:name="android.permission.INTERNET" /> in the AndroidManifest and you have a WiFi connection, this exception can be thrown. In my case, I have turned off WiFi and then turned it on again. This resolved the error. Weird solution, but sometimes it works.

无声静候 2024-11-22 15:39:44

有时在模拟器上,我必须先启动浏览器,然后我的应用程序才能访问互联网。

Some times on the emulator, I have to launch the browser before my app can access the Internet.

埋情葬爱 2024-11-22 15:39:44

"" 您似乎正在尝试解析此无效的主机。

检查 rss URL

更新
以下是可能性

1 您的浏览器配置了代理,而不是应用程序

System.setProperty("http.proxyHost", "my.proxyhost.com");
System.setProperty("http.proxyPort", "1234");

2 您的浏览器可以访问互联网。 如果 URL 受到保护,则应用程序

3 可能会出现 SSL 问题

"" it seems you are trying to resolve this host , which is invalid.

Check for rss URL

Update
Following are the possibilities

1 Your browser is configured with proxy, app not

System.setProperty("http.proxyHost", "my.proxyhost.com");
System.setProperty("http.proxyPort", "1234");

2 Your browser has access to internet. not app

3 can be an SSL issue if URL is secured

失与倦" 2024-11-22 15:39:44

我有同样的问题。我的虚拟设备在设备顶部栏显示一个被划掉的 WiFi 图标。我重新启动虚拟设备,一切恢复正常。

I had the same issue. My virtual device was showing a crossed-out WiFi icon at the top bar of the device. I rebooted the virtual device and everything was back to normal.

2024-11-22 15:39:44

可能是由于以下原因: -

  1. 您在清单文件中没有 INTERNET 权限。如果是这样,请使用此语句

  2. 或者您已连接到网络,但您的互联网连接无法正常工作。就像您已连接到 Wi-Fi 但没有互联网连接或手机上的移动数据已打开但您的手机上没有数据连接一样。

第 2 点很有趣,它不是假设,我最后也进行了相同的测试。

希望这对您有

帮助

It could be due to below reasons: -

  1. Either you dont have INTERNET permission in manifest file. If so then please use this statement <uses-permission android:name="android.permission.INTERNET" />

  2. Or you are connected to a network but your internet connection is not working. Like you are connected to a Wi-Fi but it doesnt have internet connection or Mobile data on your phone is ON but you dont have data connectivity on your phone.

Point# 2 is interesting and its not assumption, I have tested the same at my end.

Hope this will help you

Summved

岁月染过的梦 2024-11-22 15:39:44

这不是你的错,我有时会在模拟器处于奇怪状态时发生这种情况。只需重新启动模拟器即可帮助我。

It's not your fault bae, I've had this happen sometimes when the emulator's in a weird state. Just restarting the emulator helped me.

阪姬 2024-11-22 15:39:44

就我而言,当我连接到主机上的 VPN 而不是模拟器上时,我遇到了该错误。关闭VPN解决了这个问题

In my case, I had that error when I'm connected to VPN on my host but not on simulator. Turning the VPN off solved the issue

迟月 2024-11-22 15:39:44

就我而言,问题是 WIFI 与 IPV6 配合使用,而我的域没有 IPv6 地址

In my case problem was with WIFI working with IPV6 and my domain did not have IPv6 adress

ペ泪落弦音 2024-11-22 15:39:44

我遇到了同样的问题,这是因为模拟器以某种方式进入了飞行模式,一旦禁用,我的应用程序就可以正常工作了:-)
我已经尝试了一切,重建,清理+构建并重新启动android studio并重新启动计算机,甚至重新安装android studio..

I Had the same problem, and it was because the simulator somehow got in airplane mode, once this was disabled my App worked fine :-)
I had tried everything, rebuild, clean+build and reboot android studio and reboot the computer, even reinstalling android studio..

挽你眉间 2024-11-22 15:39:44

如果您在模拟器上运行该应用程序,请确保它已正确连接到互联网。如果不是,最简单的解决方法是重新打开模拟器或创建一个新设备。

If you are running the app on an emulator, make sure that it is properly connected to the internet. If it is not, the easiest way of solving it is reopening the emulator or creating a new device.

哎呦我呸! 2024-11-22 15:39:44

检查 mainfest 文件中的 INTERNET 权限并检查网络连接。

Check permission for INTERNET in mainfest file and check network connectivity.

绝影如岚 2024-11-22 15:39:44

无法解析主机“”;没有与主机名关联的地址

我遇到了这个问题,我通过这种方式解决了它。
更改

http://hostname/abc/def/ghi/name.php

< a href="http://ipaddress/abc/def/ghi/name.php" rel="nofollow noreferrer">http://ipaddress/abc/def/ghi/name.php //http://97.68.XX.YY/abc/def/ghi/name.php< /a>

我通过这种方式解决了这个问题...你必须提供服务器 IP 地址而不是主机名/服务器名。

请尝试一下并评论您的反馈。

Unable to resolve host “”; No address associated with hostname

I had this issue and I solved it by this way.
change

http://hostname/abc/def/ghi/name.php

to

http://ipaddress/abc/def/ghi/name.php //http://97.68.XX.YY/abc/def/ghi/name.php

I solved this by this way...you have to give server ip address instead of hostname/servername.

Please try this and comment your feedback.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文