簡體   English   中英

Android RSS Reader-教程錯誤

[英]Android RSS Reader - Tutorial error

我花了整整一天的時間研究Android RSS閱讀器。

我想在我的應用程序中解析一個非常簡單的XML文件。 http://www.sportinglife.com/rss/transfer_wire.xml

該站點上有多個線程可以回答RSS問題,例如https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android 我已經嘗試了所有解決方案,但是在運行代碼時,Eclipse不斷出錯。

我從2012年4月發現了最近的IBM教程,該教程很好地解釋了代碼,並僅在一個類文件中提供了一種解決方案。 http://www.ibm.com/developerworks/xml/library/x-androidxml/index.html

我已逐步按照本教程操作,但是Eclipse引發以下錯誤:

[Dex Loader] Unable to execute dex: Unexpected magic: [100, 101, 120, 10, 48, 49, 51, 0]
[FootballTransfers] Conversion to Dalvik format failed: Unable to execute dex: Unexpected magic: [100, 101, 120, 10, 48, 49, 51, 0]

有人遇到過這個問題嗎? 我不知道這個錯誤是什么意思。

當我運行https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android線程中提供的解決方案時,出現相同的錯誤。

傳遞inputstream而不是url

 @Override
        protected Void doInBackground(String... urls) {

 arrayList = new NewsParser().getData(NewsMainActivity .this.getResources.openRawResourece(R.xml.feed));

            return null;
        }

並在getData方法中將參數更改為InputStream。

 public List<NewsBean> getData(InputStream istream) {
    DocumentBuilder builder = DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder();

            System.out.println("Builder : " + builder);

            Document doc = builder.parse(istream);
    Document doc = builder.parse(istream);
.....
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM