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?
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With