Eclipse中找不到RecyclerView类

时间:2015-05-02 05:34:13

标签: android classnotfoundexception android-recyclerview

我尝试在布局xml中添加RecylerView

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <android.support.v7.widget.RecylcerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical" >
    </android.support.v7.widget.RecylcerView>

</RelativeLayout>

但是有这个错误:

  

找不到以下类:   android.support.v7.widget.RecylcerView(修复构建路径,编辑XML,   创建类)

enter image description here

我做完了:

  1. 我的eclipse中的RecyclerView库项目
  2. 标记为图书馆项目
  3. android-support-v7-recyclerview.jar添加到构建路径
  4. 检查导入/导出
  5. 然后我将这个库添加到我的项目中。
  6. 刷新并清理项目。
  7. 但错误仍然存​​在。

    注意:&#34;请回复Eclipse,而不是Android Studio&#34;

3 个答案:

答案 0 :(得分:4)

  1. 转到C:\Users\Hk-PC\Desktop\eclipse\adt-bundle-windows-x86-20140702\sdk\extras\android\m2repository\com\android\support\recyclerview-v7\22.1.1

  2. 使用Winrar打开recyclerview-v7-22.1.1.aar文件。

  3. 有一个名为classes.jar的jar文件。将其复制到项目libs文件夹。

  4. 右键单击classes.jar,添加到构建路径。

  5. 就是这样。它对我有用。希望它也适合你。

答案 1 :(得分:0)

您是否在实际的模拟器或Android手机中编译和使用了RecyclerView?我认为这是渲染库的一个问题。它在Android Studio中对我来说是一样的。

答案 2 :(得分:0)

您将通过转到\ android-sdk \ extras \ android \ support \ v7 \ recyclerview和Chcek将Recycler视图作为项目导入您的工作区通过转到其属性android,它是否标记为库,如果没有将其标记为库将其添加到项目中作为库,转到项目属性添加。

如果你已经完成了这件事,那么打开Android sdk并检查ndroid支持库版本不应该是21,因为它有一些bug,所以更新到版本22。

相关问题