https://stackoverflow.com/questions/26494346/error-inflating-class-and-android-support-v7-widget-cardview
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
Just to add on to this answer, I followed these instructions step by step, but I still had this error. To solve this error, I went into the new cardview project and opened itsAndroidManifest.xml
. There, I went to
theuses-sdk
section and made sure that its minSdkVersion
and maxSdkVersion
matched my appsminSdkVersion
and maxSdkVersion
.
That solved the error, after I followed these steps.
–
最终cardview 改AndroidManifest.xml中sdk版本号解决