I want to use CardView in my project, but when I run my application, I get the following error. I\'m using Eclipse
.
Error: Error inflating clas
import the CardView library as the Eclipse Project instead of the Android Project
This solution work on me.
1- Go to "sdk\extras\android\m2repository\com\android\support\recyclerview-v7*22.1.1*" ( 22.1.1 latest version for now. )
2- Open recyclerview-v7-22.1.1.aar file with Winrar.
3- There is a jar file named classes.jar. Copy that to your project libs folder.
4- Right click classes.jar, add to build path.
Thats it.
To fix this problem . first you must add cardview from the
That works for me.
Disable the androidx from gradle.properties file using true --> false
android.useAndroidX=false
android.enableJetifier=false
then change these lines to api v28 in build.gradle(Module:app)
compileSdkVersion 28
targetSdkVersion 28
then add these line in to build.gradle(Module:app)
`implementation 'com.android.support:appcompat-v7:28.0.0'`
`implementation 'com.android.support:recyclerview-v7:28.0.0'`
`implementation 'com.android.support:cardview-v7:28.0.0'`
`implementation 'com.android.support:design:28.0.0'`
Then sync
the project
I guess I can answer my own question.
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.
If you're using VISUAL STUDIO and get this error, try restarting VS and then Rebuild Solution. That worked for me. Hopefully this saves someone some time.