> 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):at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 02-07 08:40:47.346:E / AndroidRuntime(1027):at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 02-07 08:40:47.346:E / AndroidRuntime(1027):at 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):at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 02-07 08:40:47.346:E / AndroidRuntime(1027):at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:573) 02-07 08:40:47.346:E / AndroidRuntime(1027):at 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):at 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):在android.os.AsyncTask $ 2.call(AsyncTask.java:287) 02-07 08:40:47.346:E / AndroidRuntime(1027):at java.util.concurrent.FutureTask.run(FutureTask.java:234) 02-07 08:40:47.346:E / AndroidRuntime(1027):... 4更多
答案 0 :(得分:0)
Android运行时环境在执行时无法在类路径中找到JSoup类。 您需要确保JSoup库包含在部署到android的包中。