Android的 - 解析一个RSS feed时UnknownHost异常 [英] Android - UnknownHost exception when parsing an RSS feed
问题描述
我想分析从一个Android应用程序的RSS提要。一切有关解析RSS提要本身是做(使用SAX),但是我看到有关供稿的网址的域名解析异常。
这是造成异常的行:
feedUrl =http://blog.jonathanbenoudiz.com/feed/
。feedUrl.openConnection()的getInputStream();
java.lang.RuntimeException的: 的java.net.UnknownHostException:
于是我开始研究我的的/etc/resolv.conf
文件,并设置域名服务器指向ISP的DNS服务器。执行ping blog.jonathanbenoudiz.com
的作品,但 http://blog.jonathanbenoudiz.com
和 blog.jonathanbenoudiz.com/feed
不工作(未知主机)。
我怎么实际上应该这样做吗?
谢谢!
添加INTERNET权限到您的清单文件。
您必须加入这一行:
<使用-权限的Android:名称=android.permission.INTERNET对/>
之外的AndroidManifest.xml中的应用程序标签
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
这篇关于Android的 - 解析一个RSS feed时UnknownHost异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!