Android: Rationale Behind Support Library
I recently came across a blog explaining Android support library in a very good way, thanks to Josh Hight!
I’ve listed below some take aways from Josh’s blog for me to understand the rationale behind support library.
THE PROBLEM:
Android APIs need to evolve over time.
But there are so many devices out there, which might not keep up with latest Android release.
How can important new APIs be made available to the majority of Android users and not just those with newer devices lucky enough to run the latest releases?
2 TYPES OF SUPPORT LIBRARY:
Compatibility Libraries: v4 (Fragment, Loader, ViewPager, DrawerLayout), v7-appcompat (ActionBar, Toolbar) * v7-appcompat requires v4
Component Libraries: v7-recyclerview, v7-cardview, v7-gridlayout, v7-mediarouter, v7-palette
WHEN TO USE:
Use when you need specific framework features that are newer than you minSdkVersion, or that are not available in the standard framework.
Google considers the general use of support libraries to be a best practice.
WHICH VERSION TO USE:
Component libraries are modular, so simply add those to gradle dependencies.
Compatibility libraries are dependent. If you need one of the compatibility components from v4, you can use v13, if minSdkVersion ≥ 13.
Google Links: