我的Android應用程序停止working.Here是我的AsyncTask類代碼的AsyncTask運行時錯誤異常
package com.example.hay;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import android.content.Context;
import android.os.AsyncTask;
import android.widget.EditText;
public class AsyncLoadData extends AsyncTask<String, Void, String> {
private Context mContext;
private ILoadDataListener mListener;
public AsyncLoadData(Context context, ILoadDataListener listener) {
this.mContext = context;
this.mListener = listener;
}
@Override
protected String doInBackground(String... params) {
try {
String url = params[0];
Document doc;
doc = Jsoup.connect(url).get();
String title = doc.text();
return title;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String result) {
mListener.complete(result);
}
@Override
protected void onPreExecute() {
mListener.loading();
}
public interface ILoadDataListener {
void loading();
void complete(String result);
}
}
這似乎是有毛病我在後臺method.Logcat待辦事項(我不知道如何發佈logcat的日誌,以便我將只貼吧):
01-25 20:38:52.449: E/AndroidRuntime(878): FATAL EXCEPTION: AsyncTask #1
01-25 20:38:52.449: E/AndroidRuntime(878): java.lang.RuntimeException: An error occured while executing doInBackground()
01-25 20:38:52.449: E/AndroidRuntime(878): at android.os.AsyncTask$3.done(AsyncTask.java:299)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-25 20:38:52.449: E/AndroidRuntime(878): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.lang.Thread.run(Thread.java:856)
01-25 20:38:52.449: E/AndroidRuntime(878): Caused by: java.lang.NoClassDefFoundError: org.jsoup.Jsoup
01-25 20:38:52.449: E/AndroidRuntime(878): at com.example.hay.AsyncLoadData.doInBackground(AsyncLoadData.java:26)
01-25 20:38:52.449: E/AndroidRuntime(878): at com.example.hay.AsyncLoadData.doInBackground(AsyncLoadData.java:1)
01-25 20:38:52.449: E/AndroidRuntime(878): at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-25 20:38:52.449: E/AndroidRuntime(878): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-25 20:38:52.449: E/AndroidRuntime(878): ... 5 more
謝謝你們 歡呼