doInBackground()中的RuntimeException

时间:2017-09-22 13:12:27

标签: android android-asynctask crash-reports

我一直在用户设备的崩溃报告中收到此错误,但在我的设备中在发布和调试版本中运行良好。

java.lang.RuntimeException: 
at android.os.AsyncTask$3.done (AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:354)
at java.util.concurrent.FutureTask.setException (FutureTask.java:223)
at java.util.concurrent.FutureTask.run (FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker   (ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588)
at java.lang.Thread.run (Thread.java:818)
Caused by: java.lang.RuntimeException:  at android.os.Looper.prepare(Looper.java:102)
at android.os.Looper.prepare (Looper.java:97)
at com.wolf.nniroula.creditrecorder.activity.SplashScreen$InitData.doInBackground (SplashScreen.java)
or.onPostExecute (SplashScreen.java)
at com.wolf.nniroula.creditrecorder.activity.SplashScreen$InitData.doInBackground (SplashScreen.java)
at android.os.AsyncTask$2.call (AsyncTask.java:295)
at java.util.concurrent.FutureTask.run (FutureTask.java:237)

这是InitData()

public class InitData extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... params) {
        if (Looper.myLooper() == null)
            Looper.prepare();
        SettingManager.getInstance();
        RecordManager.getInstance(CreditApplication.getAppContext());
        CreditUtil.init(CreditApplication.getAppContext());
        return null;
    }

    @Override
    protected void onPostExecute(String result) {
        versionText.setText(CreditUtil.getCurrentVersion());
        loadingText.setText(mContext.getResources().getString(R.string.loading));
        loadDataCompleted = true;
        if (loadDataCompleted && showAnimationCompleted && !activityStarted) {
            activityStarted = true;
            startActivity(new Intent(mContext, HomeActivity.class));
            finish();
        }
    }
}

请帮助我。

0 个答案:

没有答案