27

I cannot find RecyclerView, Palette or CardView in the support libraries. Emulators responds with a "Class Not Found" error.

How can I fix an error like this?

Edric
  • 24,639
  • 13
  • 81
  • 91
zubietaroberto
  • 2,417
  • 3
  • 21
  • 15

1 Answers1

74

You require these libraries in your build.gradle.

compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'

Source: http://www.reddit.com/r/androiddev/comments/297xli/howto_use_the_v21_support_libs_on_older_versions/

zubietaroberto
  • 2,417
  • 3
  • 21
  • 15
  • 1
    It's important to note that these support libs currently force the minSdkVersion to L for your app, unless you use the first workaround specified in the source link. – Eddie Jun 27 '14 at 15:13
  • @EddieRingle I had success with explicitly setting the required support-v4 library version to `20.+` as described in http://stackoverflow.com/a/24438395/1237813 . The new widgets are available and it does not cause the bug. – user7610 Jun 27 '14 at 18:48
  • 4
    Actually, I am using "minSdkVersion 14" in the gradle.build and it is working fine as far as I know. However; targetSdkVersion must be "L", compileSdkVersion must be "android-L" and buildToolsVersion must be "20.0.0". – zubietaroberto Jun 30 '14 at 09:49
  • 1
    How do I use those new features on android projects via Ecilpse? – android developer Jul 02 '14 at 22:50
  • Cant u use this on sdk lower then L? – Jono Oct 13 '14 at 11:55
  • It has been added that "Please don't use + for builds". Please use stable version, otherwise it can lead to unpredictable builds. – Abhijit Kurane Apr 18 '15 at 17:42