Android中的Java.lang.NoClassDefFoundError

比克斯

自1天以来,我一直无法解决此问题,在AsyncTask及其执行后的意图调用期间,我遇到了它。

@Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
            // Dismiss the progress dialog
            try {
                Intent isplash= new Intent(Splash.this,MainPage.class);
                startActivity(isplash);
                finish();
            } catch (Exception e) {
                e.printStackTrace();
            } 

    }

在menefest.xml中

<activity android:name=".MainPage" 
            android:screenOrientation="landscape"></activity>

并面临错误:

Unable to resolve superclass of Lco/test/MainPage; (130)
Link of class 'Lco/test/MainPage;' failed
Could not find class 'co.test.MainPage', referenced from method co.test.Splash$GetData.onPostExecute
VFY: unable to resolve const-class 320 (Lco/test/MainPage;) in Lco/test/Splash$GetData;

FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: co.test.MainPage
at co.test.Splash$GetData.onPostExecute(Splash.java:1732)
at co.test.Splash$GetData.onPostExecute(Splash.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:602)
at android.os.AsyncTask.access$600(AsyncTask.java:156)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)

问题:调用Intent时。为什么这个?我不知道??在Google上搜索了很多时间,但是找不到任何合适的解决方案来解决问题。

吉涅什·贾恩(Jignesh Jain)

代码可能看起来像这样,

public class MyAsyncTask extends AsyncTask {

    Context context;
    private MyAsyncTask(Context context) {
        this.context = context.getApplicationContext();
    }

    @Override
    protected Object doInBackground(Object... params) {
        ...
    }

    @Override
    protected void onPostExecute(List<VideoDataDescription> result) {
        super.onPostExecute(result);
        MainActivity.progressDialog.dismiss();

        context.startActivity(new Intent(context, ResultsQueryActivity.class));
    }
}

您可以这样称呼它:

 new MyAsyncTask(context).execute();

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章