简体   繁体   中英

Android - UnknownHost exception when parsing an RSS feed

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!

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

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