Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do CardView and RecyclerView require minSdkVersion L?

When using the new Android widgets CardView and RecyclerView I've noticed that they require minSdkVersion L. So if your project uses for example minSdkVersion 14, you will get an error like this:

> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:cardview-v7:21.0.0-rc1 

I know there is a workaround that is telling Gradle to ignore the minSdkVersion of the library and use the one of the project instead.

<uses-sdk tools:node="replace" />

However if the library requires Android L, is it safe to ignore this error and use it anyway with older versions? and why did Google decided to not make them work with pre-L versions? I assume it's because it's not the final version?

like image 240
ivacf Avatar asked Jul 10 '14 16:07

ivacf


2 Answers

All of the APIs Google released at I/O (including CardView and RecyclerView) are currently only intended as previews and should not be used for production applications.

This is Google's method of preventing these libraries from showing up in production applications before they are completed and released.

like image 192
Bryan Herbst Avatar answered Nov 04 '22 16:11

Bryan Herbst


If you do want to use either of these with earlier versions of Android right now it's really easy. Just add RecyclerViewLib as a dependency in your build.gradle file.

compile 'com.twotoasters.RecyclerViewLib:library:1.0.+@aar'

The author talks about it in his blog post. All code depending on L has been removed so this is safe to use. Good luck!

like image 33
MinceMan Avatar answered Nov 04 '22 16:11

MinceMan