Exception : Android.view.inflateexception: Binary Xml File Line #2: Error Inflating Class Android.support.v7.widget.cardview
Solution 1:
Let import cardview as a library: Go to File -> Import -> Existing Android code into workspace --> Browse (Go to sdk/extras/android/support/v7/cardview) --> Click ok --> Click Finish
Your project explorer will now show cardview as a project.
Right click on cardview project --> Properties --> Android(Left Pane) --> Enable isLibrary (tick the checkbox) --> Apply --> ok
Now Right click on your project --> Properties --> Android(Left pane) --> Add (under library) --> cardview --> apply --> ok
Now right click on your project again --> build path --> configure build path --> Under projects tab, add cardview
You are done. Source
Solution 2:
(for intellij users)
- click in your project,
- right click -> open Module Settings
- import cardview from \sdk\extras\android\support\v7\
- add .jar file to cardview module
- click on your project and give module dependency to cardview
- now, click (+) button on cardview -> android -> at top you will see a check box (library module), enable it.
- click ok and close your settings dialog.
- rebuild your project and run it.
Solution 3:
Support libs that contain resources other than compiled classes (like XMLs) cannot be added as just jars.
Please follow the steps described by this:
https://developer.android.com/tools/support-library/setup.html#libs-with-res
Let us now if that works.
Solution 4:
To fix this problem . first you must add cardview from the \sdk\extras\android\support
- Close the main project.
- Remove the android-support-v7-appcompat .
- Restart the Eclipse.
- Add the android-support-v7-appcompat .
- Clean,To build the project.
- Then open the main project and build all the projects.
- The error still remains. Restart eclipse. That's it.
That works for me.
Solution 5:
Try this..
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp">
</android.support.v7.widget.CardView>
Reference : Create Cards
Post a Comment for "Exception : Android.view.inflateexception: Binary Xml File Line #2: Error Inflating Class Android.support.v7.widget.cardview"