The Android Developer’s Cookbook: Building Applications with the Android SDK, Second Edition (2013)
B. Using the Compatibility Pack
The compatibility pack, or support library, is a set of classes that have been provided to add support to legacy versions of Android (the minimum API level supported is 4).
Android Support Packages
The support library adds the following packages:
android.support.v4.accessibilityservice
android.support.v4.app
android.support.v4.content
android.support.v4.content.pm
android.support.v4.database
android.support.v4.net
android.support.v4.os
android.support.v4.util
android.support.v4.view
android.support.v4.view.accessibility
android.support.v4.widget
Table B.1 shows the class that is included in the android.support.v4.accessibilityservice package.
Table B.1 android.support.v4.accessibilityservice
Table B.2 shows the interfaces, classes, and exceptions that are included in the android.support.v4.app package.
Table B.2 android.support.v4.app
Table B.3 shows the interface and classes that are included in the android.support.v4.content package.
Table B.3 android.support.v4.content
Table B.4 shows the class included in the android.support.v4.content.pm package.
Table B.4 android.support.v4.content.pm
Table B.5 shows the class included in the android.support.v4.database package.
Table B.5 android.support.v4.database
Table B.6 shows the classes included in the android.support.v4.net package.
Table B.6 android.support.v4.net
Table B.7 shows the interface and class included in the android.support.v4.os package.
Table B.7 android.support.v4.os
Table B.8 shows the classes included in the android.support.v4.util package.
Table B.8 android.support.v4.util
Table B.9 shows the interfaces and classes included in the android.support.v4.view package.
Table B.9 android.support.v4.view
Table B.10 shows the classes that are included in the android.support.v4.view.accessibility package.
Table B.10 android.support.v4.view.accessibility
Table B.11 shows the interfaces and classes that are included in the android.support.v4.widget package.
Table B.11 android.support.v4.widget
Adding the Support Library to a Project
Adding the support library to a project is a fairly simple and straightforward endeavor. It needs to be downloaded and installed, then added to the build path of the project.
The support library is downloaded through the Android SDK Manager. It can be found in the Extras folder as Android Support Library. When installed, the required .jar files can be found in the SDKInstallationFolder/extras/android/support/VersionNumber/ directory, whereSDKInstallationFolder is where the Android SDK is installed and VersionNumber is the current version of the support library (at the time of this writing, it is called v4).
To add the .jar to an application, create a folder in the project named libs, copy the .jar file into the folder, and add the .jar to the build path.
In Eclipse, refresh the project, open the libs folder, and right-click on the support .jar. From the context menu, choose Build Path → Add to Build Path. When finished, make sure to initiate the support library pieces needed by including them as imports and changing any required include statements to the support versions.