简体   繁体   English

I / O失败:java.net.UnKnownHostException

[英]i/o failure: java.net.UnKnownHostException

Working on an Android application... 在Android应用程序上工作...

I'm getting this error message: 我收到此错误消息:

i/o failure: java.net.UnKnownHostException: Unable to resolve host
"api.parse.com": No address associated with hostname

Many suggest to add internet permission in the manifest file, I have these permissions already: 许多建议在清单文件中添加Internet权限,我已经具有以下权限:

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

Any suggestions? 有什么建议么?

Thanks! 谢谢!

I'm guessing that the device is not connected to the private LAN that has the DNS server that resolves the hostname. 我猜该设备未连接到具有解析主机名的DNS服务器的专用LAN。 The emulator shares the network connectivity of its host; 仿真器共享其主机的网络连接; not so the real device. 不是真正的设备。 The error says that the dns server the device is talking to can't resolve the name. 该错误表明设备正在与之通信的dns服务器无法解析该名称。 It may also mean we can't talk to the dns server. 这也可能意味着我们无法与dns服务器通信。

You have these two entries in AndroidManifest.xml file: 您在AndroidManifest.xml文件中具有以下两个条目:

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

I don't think there might be other reason for that except the connection. 我认为除了连接之外,可能没有其他原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM