Problems with Android V7 CardView Library support for work

I am using IntelliJ / Android Studio with Ant build (not Gradle at the moment) and I am trying to use android-support-v7-cardview.jar, but I keep getting

android.view.InflateException: Binary XML file line #19: Error inflating class android.support.v7.widget.CardView java.lang.NoClassDefFoundError: android.support.v7.cardview.R$styleable 

I do not use m2repository with aar file, but use map in place

 sdk/extras/android/support/v7 

I got the job using the classes from jar in my own project, but this requires API 21 (5.0), which I don't want to use yet. I am trying to use the jar file in the libs folder and res files from

  sdk/extras/android/support/v7/cardview/res 

I added the lib and res files to my own project, but I still get the error messages above. What should I do?

+7
android android-cardview
source share
5 answers

I did not understand the error, but I just commented on the material that uses Android 5.0 in the library source code, and it works fine. I did not want to use minSdk for Android 5.0.

0
source share

I had the same problem after adding compile 'com.android.support:cardview-v7:23.2.1' to create .gradle dependencies for using CardView, however after cleaning up the project (Build> Clean Project) everything worked like magic.

+14
source share

Hi, this may be useful, it worked for me. (for intelligent users)

  • click in your project
  • right click -> open module settings (f4)
  • import cards from \ sdk \ extras \ android \ support \ v7 \
  • add .jar file to cardview module
  • click on your project and report on the dependence of the module on the type of map.
  • now press the (+) button on the map β†’ android β†’ at the top you will see a checkbox (library module), enable it.
  • Click OK and close the settings dialog box.
  • rebuild your project and run it.
+2
source share

I think you need to import it as an Android library project, and then you need to find the right resources. I also tried first importing only the jar that didn't work, so I did it like this:

  • The CardView project is located in the Android SDK folder: Android \ android-sdk \ extras \ android \ support \ v7 \ cardview
  • In Eclipse, use "Import" and select "Existing Android Code in the Workspace" and import the CardView project
  • Go to β€œProperties” β†’ Android of the new project, mark it as a library project and then link it as a library project in your own project where CardView cannot be found.

It should do it

0
source share

If you use Android Studio , then it will be easier, add compile 'com.android.support:cardview-v7:21. + ' depending on the build .gradle.

 dependencies { compile 'com.android.support:cardview-v7:21.+' } 
0
source share

All Articles