-2
>     private class RssFeedTask extends AsyncTask<String, Void, String> {
>       String response = "";
>     
>       @Override
>       protected void onPreExecute() {
>           // TODO: Dialog
>       }
>     
>       @Override
>       protected String doInBackground(String... urls) {
>           try {
>               String feed = "http://google.com";
>               HtmListParser rh = new HtmListParser();
>               rssStr = rh.getLatestArticles(feed);
>           } catch (Exception e) {
>               Log.e("error_connection", "Error in http connection "+e.toString());
>           }
>           return response;
>     
>       }
>     
>       @Override
>       protected void onPostExecute(String result) {
>           // TODO: dismiss Dialog and set adapter
>       }
>     }



>     public class HtmListParser {
>       private RssFeedStructure feedStr = new RssFeedStructure();
>       private List<RssFeedStructure> rssList = new ArrayList<RssFeedStructure>();
>     
>     
>       public List<RssFeedStructure> getLatestArticles(String feedUrl) {
>            try {                                              
>              Document doc = Jsoup.connect(feedUrl).get();
>              
>             } catch (IOException e) {
>                 // TODO Auto-generated catch block
>                 e.printStackTrace();
>             }
>            
>     
>           return null;
>       }
>     
>     }


**and The Exceptions:**
02-07 08:40:47.346: E/AndroidRuntime(1027): FATAL EXCEPTION: AsyncTask #1
02-07 08:40:47.346: E/AndroidRuntime(1027): java.lang.RuntimeException: An error occured while executing

doInBackground() 02-07 08:40:47.346: E/AndroidRuntime(1027): 在 android.os.AsyncTask$3.done(AsyncTask.java:299) 02-07 08:40:47.346: E/AndroidRuntime(1027) : 在 java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 02-07 08:40:47.346: E/AndroidRuntime(1027): 在 java.util.concurrent.FutureTask.setException(FutureTask.java:219 ) 02-07 08:40:47.346: E/AndroidRuntime(1027): 在 java.util.concurrent.FutureTask.run(FutureTask.java:239) 02-07 08:40:47.346: E/AndroidRuntime(1027):在 android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 02-07 08:40:47.346: E/AndroidRuntime(1027): 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080 ) 02-07 08:40:47.346: E/AndroidRuntime(1027): 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 02-07 08:40:47.346: E/AndroidRuntime(1027): 在 java.lang.Thread.run(Thread.java:856) 02-07 08:40:47.346: E/AndroidRuntime(1027): 引起作者:java.lang.NoClassDefFoundError:org.jsoup.Jsoup 02-07 08:40:47.346:E/AndroidRuntime(1027):在 com.newsinlevels.helper.HtmListParser.getLatestArticles(HtmListParser.java:20) 02-07 08 :40:47.346: E/AndroidRuntime(1027): at com.newsinlevels.activity.MainActivity$RssFeedTask.doInBackground(MainActivity.java:120) 02-07 08:40:47.346: E/AndroidRuntime(1027): at com. newsinlevels.activity.MainActivity$RssFeedTask.doInBackground(MainActivity.java:1) 02-07 08:40:47.346: E/AndroidRuntime(1027): at android.os.AsyncTask$2.call(AsyncTask.java:287) 02- 07 08:40:47.346: E/AndroidRuntime(1027): 在 java.util.concurrent.FutureTask.run(FutureTask.java:234) 02-07 08:40:47.346: E/AndroidRuntime(1027): ... 4 更多

4

1 回答 1

0

Android运行环境执行时找不到类路径中的JSoup类。您需要确保 JSoup 库包含在部署到 android 的包中。

于 2013-02-07T09:17:42.270 回答