What Android Library Am I On?09 Jul 2013
Google maintains some handy support packages that allow older versions of Android to use otherwise unavailable APIs. It’s a win-win for most - developers can support older devices more easily, Google looks great because they are making developers’ lives easier, and Android users aren’t forced to upgrade their phones to have access to a large selection of apps. There are losers, and one of them is me: the developer who looks at the revision history for the support library and realizes there may be relevant fixes in newer revisions. I need to figure out which revision I’m on now, so I look in the libs folder, see the support library android-support-v4.jar and ask myself, “What is the version of this support library?”
The filename of the JAR itself yields nothing; v4 simply refers to the minimum API level supported by that particular library. The manifest file of the JAR disappointingly does not have any information. Fine; let’s grab the MD5 checksum. But what to do with this checksum? Google’s Android documentation does not provide checksums for the different revisions of the library. Launching the Android SDK Manager, I find revision 13 installed in my Android SDK bundle, but the checksum of that revision does not match the checksum of the mysterious library currently sitting in my project.
Okay, let’s go through all the previous versions and get checksums for them. But wait… I can’t downgrade my support library via the Android SDK Manager! The revision history page also doesn’t have any download links for older revisions. Although Google has done a poor job of putting download links in a visible place, it has fortunately done a good job of maintaining their revisions in an orderly manner. Visit this URL, replacing the rXX with the version of the support package you want (e.g. r04 through r13 as of July 2013). After grabbing all available revisions, I created a table filled with the support libraries’ MD5 checksums:
|Revision||v4 library MD5||v7 library MD5||v13 library MD5|
Turns out, we were using revision 6 of the v4 support library. Between this and the latest version, new functionality was added and “many [Fragment] bugs” were fixed. We use Fragments in a few places, so we’re pushing ahead with the upgrade. Figuring out what version you are using shouldn’t be this difficult. Some might argue that developers should do book-keeping on the libraries they are using. But if you’re dedicating resources to putting out and iterating on packages used by many, you could at least invest some time to attach relevant metadata to those packages. In this particular case, involving a JAR file, setting up a manifest file with a bundle version is both easy for those creating the packages and helpful for those using the packages. In the meantime, the JAR file has been renamed to android-support-v4-rev13.jar.