[英]Unable to add CardView to layout in Eclipse
I am using Eclipse and trying to add CardView
to my layout. 我正在使用Eclipse并尝试将CardView
添加到我的布局中。 However I keep getting an exception: 但是我一直有例外:
02-27 23:33:41.982: E/AndroidRuntime(20071): FATAL EXCEPTION: main
02-27 23:33:41.982: E/AndroidRuntime(20071): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.materialcontactpicker/com.example.materialcontactpicker.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.CardView
... most of the crap that you usually ignore ...
02-27 23:33:41.982: E/AndroidRuntime(20071): Caused by: java.lang.NoClassDefFoundError: android.support.v7.cardview.R$styleable
02-27 23:33:41.982: E/AndroidRuntime(20071): at android.support.v7.widget.CardView.initialize(CardView.java:203)
02-27 23:33:41.982: E/AndroidRuntime(20071): at android.support.v7.widget.CardView.<init>(CardView.java:101)
02-27 23:33:41.982: E/AndroidRuntime(20071): ... 24 more
I have: 我有:
1. Imported appcompat_v7
to my workspace, added it to libraries. 1.将appcompat_v7
导入我的工作区,将其添加到库中。
2. Imported cardview
project and added it to libraries. 2.导入的cardview
项目并将其添加到库中。
3. Configured the build path and added cardview
to the "Projects". 3.配置构建路径并将cardview
添加到“项目”。
4. My targetSdkVersion
is 21. 我的targetSdkVersion
是21。
However, I still get the error. 但是,我仍然得到错误。
How do I solve this? 我该如何解决这个问题?
I faced the similar issue yesterday in eclipse. 昨天我在日食中遇到了类似的问题。 Below steps work for me. 以下步骤适合我。
Hope it helps.. 希望能帮助到你..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.