Android的 - 解析一个RSS feed时UnknownHost异常异常、RSS、Android、UnknownHost

由网友(酒话醉心i)分享简介:我想分析从一个Android应用程序的RSS提要。一切有关解析RSS提要本身是做(使用SAX),但是我看到有关供稿的网址的域名解析异常。这是造成异常的行:feedUrl =htt​​p://blog.jonathanbenoudiz.com/feed/。feedUrl.openConnection()的getInpu...

我想分析从一个Android应用程序的RSS提要。一切有关解析RSS提要本身是做(使用SAX),但是我看到有关供稿的网址的域名解析异常。

这是造成异常的行:

  feedUrl =htt​​p://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 RSS首页 文档和下载 RSS阅读软件 OSCHINA

您必须加入这一行:

 <使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
 

之外的Andr​​oidManifest.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

阅读全文

相关推荐

最新文章