这是我的代码:
public static void deleteFile(stPath){
File yourDir = new File(stPath); **// Line 210 in MyUtil.java**
//
....
///
}
我在 AsynTask 方法中调用它:
private class Backup extends AsyncTask<String, Void, Exception> {
@Override
protected void onPreExecute() {
showProgressDialog(StringUtil.getString(R.string.backucking));
}
@Override
protected Exception doInBackground(String... params) {
deleteFile(stPath);
return null;
}
@Override
protected void onPostExecute(Exception result) {
showProgressDialog(StringUtil.getString(R.string.downloading));
}
}
当我运行时,它会抛出一个错误 java.lang.NoClassDefFoundError。Android 找不到 java.io.File?? 我不明白。你能给我解释一下吗?
这是我的日志:
java.lang.RuntimeException: An error occured while executing doInBackground()
--------- Stack trace ---------
android.os.AsyncTask$3.done(AsyncTask.java:299)
java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
java.util.concurrent.FutureTask.setException(FutureTask.java:124)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
java.util.concurrent.FutureTask.run(FutureTask.java:137)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
java.lang.Thread.run(Thread.java:856)
-------------------------------
--------- Cause ---------
java.lang.NoClassDefFoundError: mypakage/d/a/b/d
com.mypakage.util.b.e(MyUtil.java:210)
com.mypakage.view.main.f.a(OneView.java:1046)
com.mypakage.view.main.f.doInBackground(OneView.java:1)
android.os.AsyncTask$2.call(AsyncTask.java:287)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
java.util.concurrent.FutureTask.run(FutureTask.java:137)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
java.lang.Thread.run(Thread.java:856)
-------------------------------