问题
I want to parse an rss feed from an android application. Everything related to parsing the RSS feed itself is done (using SAX), however I get an exception regarding the name resolution of the feed's url.
This is the line causing the exception:
feedUrl = "http://blog.jonathanbenoudiz.com/feed/"
feedUrl.openConnection().getInputStream();
java.lang.RuntimeException: java.net.UnknownHostException:
So I started investigating my /etc/resolv.conf
file and set the nameserver to the dns server of my ISP. Pinging blog.jonathanbenoudiz.com
works, but http://blog.jonathanbenoudiz.com
and blog.jonathanbenoudiz.com/feed
don't work (unknown host).
How am I actually supposed to do this?
Thanks!
回答1:
Add the INTERNET permission to your manifest file.
You have to add this line:
<uses-permission android:name="android.permission.INTERNET" />
outside the application tag in your AndroidManifest.xml
来源:https://stackoverflow.com/questions/6125595/android-unknownhost-exception-when-parsing-an-rss-feed