简体   繁体   English

Android-java.lang.NoClassDefFoundError-AdapterView

[英]Android - java.lang.NoClassDefFoundError - AdapterView

I have searched all over for a solution and have found nothing. 我到处搜寻解决方案,却一无所获。 I deployed my app to my phone and was using it for a few days without any issues. 我将应用程序部署到了手机上,并且使用了几天没有出现任何问题。 All of a sudden out the blue, the launch of a particular activity started to cause the app to force close even though previously it loaded just fine. 突然,特定活动的启动开始导致应用强制关闭,即使以前加载得还不错。

I then ran the app from Eclipse to my phone so that I can see the errors: 然后,我将应用程序从Eclipse运行到手机上,以便可以看到错误:

07-12 10:53:11.309: W/dalvikvm(24295): VFY: unable to find class referenced in signature (Landroid/widget/AdapterView;)
07-12 10:53:11.309: W/dalvikvm(24295): VFY: unable to find class referenced in signature (Landroid/widget/AdapterView;)
07-12 10:53:11.529: W/dalvikvm(24295): threadid=1: thread exiting with uncaught exception (group=0x41370360)
07-12 10:53:11.529: E/AndroidRuntime(24295): FATAL EXCEPTION: main
07-12 10:53:11.529: E/AndroidRuntime(24295): java.lang.NoClassDefFoundError: [generic]
07-12 10:53:11.529: E/AndroidRuntime(24295):    at dalvik.system.NativeStart.main(Native Method)

I think it has to do with setting the onItemSelected listener for a Spinner. 我认为这与为Spinner设置onItemSelected侦听器有关。 If I comment out yearSpinner.setOnItemSelectedListener(this); 如果我注释掉yearSpinner.setOnItemSelectedListener(this); there are no issues. 没有问题。

Here are the 2 methods that are implemented. 这是实现的两种方法。 I have left them as stubs to narrow down the issue. 我把它们留给了他们以缩小问题的范围。

@Override
    public void onItemSelected(AdapterView<?> parent, View view, int position,
            long id) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {
        // TODO Auto-generated method stub

    }

Also, everything is checked in the build path. 同样,所有内容都在构建路径中检查。

How can I fix this issue? 如何解决此问题?

Update: This resolved itself after I restarted my phone. 更新:重新启动手机后,此问题自行解决。 I am not sure how to prevent this from happening again. 我不确定如何防止这种情况再次发生。

Actually I don't know what problem you have got, have you tried to clean your project if you sure that no changed you have did? 其实我不知道您遇到了什么问题,如果您确定自己没有做任何更改,是否尝试过清理项目? but your problem quite similar with these links : java.lang.NoClassDefFoundError: [generic] at dalvik.system.NativeStart.main(Native Method) java.lang.NoClassDefFoundError on android 但是您的问题与这些链接非常相​​似: java.lang.NoClassDefFoundError:[通用]在dalvik.system.NativeStart.main(Native Method) 在Android上的java.lang.NoClassDefFoundError

hope will fix your problem 希望能解决您的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM