eclipse 中导入RecyclerView
来源:互联网 发布:ubuntu搭建openstack 编辑:程序博客网 时间:2024/05/22 00:05
使用eclipse引用RecyclerView,一运行就挂掉,错误如下:
- 07-22 23:05:34.553: D/AndroidRuntime(2968): Shutting down VM
- 07-22 23:05:34.560: E/AndroidRuntime(2968): FATAL EXCEPTION: main
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Process: com.zh.myrecyclerview, PID: 2968
- 07-22 23:05:34.560: E/AndroidRuntime(2968): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zh.myrecyclerview/com.zh.myrecyclerview
- .MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class android.support.v7.widget.RecyclerView
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.ActivityThread.access$800(ActivityThread.java:144)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.os.Handler.dispatchMessage(Handler.java:102)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.os.Looper.loop(Looper.java:135)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.ActivityThread.main(ActivityThread.java:5221)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.reflect.Method.invoke(Native Method)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.reflect.Method.invoke(Method.java:372)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class android.support.v7.widget.RecyclerView
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.createView(LayoutInflater.java:633)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.Activity.setContentView(Activity.java:2144)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at com.zh.myrecyclerview.MainActivity.onCreate(MainActivity.java:20)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.Activity.performCreate(Activity.java:5933)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): ... 10 more
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Caused by: java.lang.reflect.InvocationTargetException
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.reflect.Constructor.newInstance(Native Method)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.view.LayoutInflater.createView(LayoutInflater.java:607)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): ... 21 more
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/recyclerview/R$styleable;
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:434)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:404)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): ... 24 more
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.recyclerview.R$styleable" on path: DexPathList[[zip file "/data/app/com.zh.myrecyclerview-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): ... 26 more
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Suppressed: java.lang.ClassNotFoundException: android.support.v7.recyclerview.R$styleable
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.Class.classForName(Native Method)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
- 07-22 23:05:34.560: E/AndroidRuntime(2968): ... 27 more
- 07-22 23:05:34.560: E/AndroidRuntime(2968): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
- 07-22 23:05:37.406: I/Process(2968): Sending signal. PID: 2968 SIG: 9
试了很多方法都不行,整了半天,终于搞定,原来在eclipse中使用RecyclerView只能导入API21.0.0中的包才可以使用。
解决办法:进入sdk\extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0目录,找到recyclerview-v7-21.0.0.aar这个文件。用解压软件解压此文件里面有classes.jar,把这个jar包放到项目中的libs文件下即可。这个jar包就是RecyclerView要使用的,可以给它改个名字例如android-support-v7-recyclerview.jar , 便于查看。
2 0
- eclipse 中导入RecyclerView
- RecyclerView导入到eclipse问题
- eclipse 中使用 RecyclerView
- android studio中导入RecyclerView
- eclipse中导入v7包 android-support-v7-appcompat 和 android-support-v7-recyclerview
- Eclipse中正确使用RecyclerView
- 【Android】eclipse中使用RecyclerView
- openfire导入eclipse中
- eclipse中导入nutch
- Peersim导入Eclipse中
- eclipse中导入jena
- Hadoop导入Eclipse中
- Eclipse中导入源码
- eclipse中导入opencv
- android 在eclipse中使用RecyclerView
- 在Eclipse中,使用v7-recyclerview问题
- Android 4.4Eclipse项目中使用RecyclerView
- 在Eclipse中,使用v7-recyclerview问题
- protocol isis issues
- IOS 使用NJKWebViewProgress做webview加载进度条
- Linux命令
- PHP框架CodeIgniter入门使用(2)
- JDBC-连接mysql查询数据时中文为空解决办法
- eclipse 中导入RecyclerView
- Xcode7 The resource could not be loaded because the App Transport Security
- C++ 与js 2
- Core Animation 的隐式动画
- TreeSet --实现学生按年龄大小和姓名排序
- JVM自带的监控工具
- 远程设置Mac 黑名单和踢下线实现
- 数据库连接池
- 【NOIP 2002】字串变换