简体   繁体   中英

i/o failure: java.net.UnKnownHostException

Working on an Android application...

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:

<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. 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. It may also mean we can't talk to the dns server.

You have these two entries in AndroidManifest.xml file:

<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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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