我想分析从一个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 RSS首页 文档和下载 RSS阅读软件 OSCHINA](/d/file/2023/09-17/6668360b7718fd0d3c24a98bb4a182e3.png)
您必须加入这一行:
<使用-权限的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
相关推荐
最新文章