Didn't find class "android.support.v7.widget.RecyclerView"

Ubuntu + Eclipse, android sdk路径:/home/steven/android-sdk-linux


再学习使用RecyclerView,按照教程的Demo,在Eclipse里重写了一遍。在模拟器上运行出错。

提示 Didn't find class "android.support.v7.widget.RecyclerView".

首先你要把android.support.v7.widget.RecyclerView.jar这个包通过右键项目properties->java bulid path->libraries->add external jars加进去。我的android.support.v7.widget.RecyclerView.jar路进在/home/steven/android-sdk-linux/extras/android/support/v7/recyclerview/libs下。

然后在order and export里面勾选上android.support.v7.widget.RecyclerView.jar(发布的时候复制过去)


这时候再在模拟器上运行,还是提示错误: Didn't find class "android.support.v7.widget.RecyclerView".

这是因为android.support.v4的版本不匹配的问题,android.support.v7.widget.RecyclerView.jar会引用android.support.v4,但是它依赖的是android-sdk-linux/extras/android/support/v4/android.support.v4.jar,右键项目properties->java bulid path->libraries找到

android.support.v4.jar删除它,重新add external jars,我的路径是/home/steven/android-sdk-linux/extras/android/support/v4/android.support.v4.jar,最好在order and export里把android.support.v4也勾选上。


你可能感兴趣的:(android)