Support Library: More than a shim
Android’s Support Library provides backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Most of us use them to build features using new technology that will also work on older, let’s call them legacy, platforms. Honeycomb introduced the Fragment. Lollipop gave us the RecyclerView. Both good examples of what the Support Library gets right.
But here’s something I hadn’t considered: During his session at AnDevCon Santa Clara, Doug Stevenson threw out this tasty bit: Some people use the Support Library to get bug fixes to framework APIs that wouldn’t otherwise be available until the next android release. When given a choice, they’ll always use it. It’s so obvious that I almost smacked my forehead.
Until that moment, I’d always tried to avoid using the Support Library when I didn’t have to use it. I’d always considered it a shim. The framework APIs were as close to pure as can be, and obviously, a pure implementation is clearly better than a support library. I just didn’t think it through.
The Support Library is released about once a month. Android is released once a year (not including the rare security release). And carriers rarely update their devices, if ever. Even for their flagship devices.
All of which point to one obvious conclusion: Use the Support Library for everything. Unless there’s a compelling reason to not use the Support Library, and I can’t think of one, use it!