Could not find class 'com.example.adapter.MyCursorAdapter' referenced from method com.example..

今天看support.v4包下面的CursorAdapter的源码时做了如下操作导致了此异常如下图所示


操作:
1.由于Android开发中每当新建一个项目的时候系统会自带android-support-v4.jar包,所以它就认为这个jar包和系统是一起的所以看其中的源码时找不到,这时候就需要把它移除掉
我做了如下的Remove操作


2.手动的Add to Build Path(我做了如下的Add to Build Path操作)


做了这两步之后就可以看support v4包下面的源码了,但是运行时报了错误Could not find class 'com.example.adapter.MyCursorAdapter' referenced from method com.example..
原因是我们手动导入v4包后在Order and Export中并没有选中它, 当我们用到此包下的类时就会崩溃



解决办法:把上图的v4包前面的对勾打上,就ok了

猜你喜欢

转载自blog.csdn.net/dmk877/article/details/44984039