The Android Support Library can be confusing at times, for new beginners and even for the experienced Android developers. I’m listing here a few key points to demystify the Android Support Library, and hopefully help you better understand it.

Source: created based on Google Developers overview on Youtube — link below

A collection of libraries

First of all, the Android Support Library is a collection of libraries, some of which inter-depend on each other. To include a particular library, just add it to your app build.gradle file. By default, when you create a new project with the Android Studio, the v7 AppCompat library is already included. You will notice that your Activity class extends from AppCompatActivity.

Naming convention

Many of the support libraries have a number in their names: v4, v7, v13…. That number is not a traditional software version number, it actually indicates how far back of Android API the library will support (minSDKVersion). Then each library has a revision number which is its release version; for example now the Android Support Library is now on revision 25.0.0.

Not just for compatibility

I often hear developers new to Android development say: “I’m going to work with the latest and greatest Android API level, so that I don’t need to worry about backwards compatibility or using the Android Support Library.”

Although the support library started out as providing backwards compatibility, it has evolved into a way of providing additional features. Examples include RecyclerView and CardView. In another word, even if you set fairly high minSDKVersion for your app, you still have to use the support libraries, not for the sake of backwards compatibility but for the sake of being able to implement some features.

Small inconsistencies

The APIs between the default framework and the support library are supposed to be the same but not always. For example, SupportFragmentManager (v4) has a method that returns a list of fragments but FragmentManager doesn’t.

Making a choice on which one to use

We know that we can use ViewPager to horizontally slide through a number of pages. This is a classic example of possible confusion so I’d like to use it to illustrate how to make a choice on which library to use.

First of all, as I mentioned earlier, by default your Activity extends from v7 AppCompatActivity. Secondly, the ViewPager object is available only from the v4 support library. Finally, there are two PagerAdapters you can choose for the ViewPager: FragmentPagerAdapter and FragmentStatePagerAdapter, both of which are available in either the v4 or v13 libraries.

So which PagerAdapter do you choose: v4 or v13?

If you choose a v4 PagerAdapter, then you need to work with the v4 Fragment and SupportFragmentManager.

If you choose a v13 PagerAdapter, then you need to work with the Fragment and FragmentManager from the default Framework.

In this particular case, I find it less confusing and more consistent to just stick with v4 all the way: ViewPager, PagerAdapter, Fragment and SupportFragmentManager.

Update the Android Support Library

In Android Studio, click the SDK Manager icon from the menu bar, launch standalone SDK Manager, select Android Support Repository and click “Install x packages” to update it.

Note you will see both Android Support Repository and Android Support Library listed in the SDK Manager. You might be wondering what is the difference between the two. Make sure to choose Android Support Repository if you are using Android Studio. The Android Support Library item is for those who are still on Eclipse.

Learning resources & references

Here are a few great resources for you to learn the Android Support Library in more depth: