RecyclerView导入bug解决

android开发在eclipse中使用V7包中的RecyclerView的时候出现了下面的bug;

bug:

E/AndroidRuntime( 1861): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class android.support.v7.widget.RecyclerView

E/AndroidRuntime( 1861):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
E/AndroidRuntime( 1861):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
E/AndroidRuntime( 1861):     at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
E/AndroidRuntime( 1861):     at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
E/AndroidRuntime( 1861):     at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
E/AndroidRuntime( 1861):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
E/AndroidRuntime( 1861):     at android.app.Activity.setContentView(Activity.java:2144)
E/AndroidRuntime( 1861):     at com.example.study_recyclerview.MainActivity.onCreate(MainActivity.java:30)
E/AndroidRuntime( 1861):     at android.app.Activity.performCreate(Activity.java:5937)
E/AndroidRuntime( 1861):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 1861):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime( 1861):     ... 10 more
E/AndroidRuntime( 1861): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.RecyclerView" on path: DexPathList[[zip file "/data/app/com.example.study_recyclerview-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

E/AndroidRuntime( 1861):     at dalvik.system.BaseDexClassLoa

.............................................................

这个问题纠结了一上午时间,试过了网上的几乎所有办法都没有弄好。参考了http://blog.csdn.net/u010351494/article/details/47022601这片文章但还没有弄好,但总算是得到了点信息,是啊V7中的sdk/extras/android/support/v7/recyclerview/下面的文件结构是一个标准的android工程啊。

好吧,现在这么弄;

                               1.用eclipse 的 import命令把sdk/extras/android/support/v7/recyclerview/导入工程,最好复制到工作目录;

                               2.build path ----- >> configure build path... ------>> android ----->> is libary 打勾 ----->> apply ----->> ok;

                               3.在你自己的工程中 先移除掉以前添加的recyclerview 的jar包,然后build path ----- >> configure build path... ------>> android ----->> add ----->> 点击recyclerview  ----->> ok;

                               4.最好把你工程窗中的recyclerview的api和你的api版本用成一个,recyclerview----->>build path ----- >> configure build path... ------>> android ----->>在上面选择你的工程api相同的api版本;

                               这样应该就好了吧。

                              

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值