I wanted to know the difference between android-support-v4.jar and android-support-v7-appcompat.jar. If I want to add appcompat Action Bar in my application do I need to add both android-support-v7-appcompat.jar and android-support-v4.jar or only android-support-v7-appcompat.jar.
Also, does android-support-v13.jar has appcompat?
android-support-v4.jar: Support
android.app
classes to assist with development of applications for android API level 4 or later. So that you will able to make your application backword compatible,android-support-v7.jar It is recently added in latest support library updation. ActionBar to allow implementation of the action bar user interface design pattern back to Android 2.1 (API level 7) and higher. Use of this class requires that you implement your activity by extending the new
ActionBarActivity
class.Yes you need to add reference of both libraries if you want to use it.
No, It includes FragmentCompat so that if some of the Fragment feature add added after version 13 than you can make it backword compatible to Api level 11. so that Application targeting API 11 or greater can use feature which added on newer versions.
What is a support library?
Support libraries are code libraries(Collection of classes) which makes a newly added feature to work with the older devices.
For example, Material Design was introduced in API 21 (Android 5.0 - Lolipop) but the v7 support library makes it available for API 7 (Android 2.1.x -Eclair) and higher.
What are different support libraries?
Some of the main support libraries are
V4 Support library
V7 Support library
V8 Support library
v13 Support library
What does 7 stand for in v7 Support Library?
It means this library has features designed to be used with API level 7 and higher. Same goes with V4 (contains features meant for API 4 and higher) and so on.
Difference between v7 Support library and v7 appcompat library?
Few people including me get confused with these two terms. Actually, v7 appcompat library is a part of v7 Support library. v7 support library was mainly developed to support Material design and ActionBar design pattern for API 7 and higher.
V7 can be categorized into more sub categories
v7 appcompat library
v7 cardView library
v7 appcompat library has following key classes ActionBar, ActionBarActivity, ShareActionProvider.
So adding
dependency in your gradle file imports the above-mentioned classes.
Bonus
Multidex Support Library (For creating apps with more than 65k methods)
v17 Leanback support Library (A Support library which provides important widgets for Android TV)
Relevant links
Support Library Features
Support Library Packages
UPDATE
There are many changes done into support library since this question was answered. Good thing is, it is very well documented also. So you must read Support Library Documentation for more details and more available support library.
Below is difference from Support Library Packages:
So yes you need both jars if you want to use v7.
Update for android-support-v13.jar
v13 Support LibraryWhen you see the package details it has a class FragmentCompat as given in definition. So it has not the all classes of appcompat library.
First, we need to understand, What is the Android Support Library?
The Android Support Library was originally released in 2011, You can say that as the Android Compatibility Library.the Android Support Library provides newer APIs for older releases.but the story is not enough.
this can be little confusing that support libraries with higher version numbers include the features from previous libraries (you might think v7-appcompat improves upon and includes all features from v4). In most cases, this is incorrect.but libraries themselves have a revision number. For example, “AppCompat v21” actually refers to support library v7-appcompat, revision 21.
1-Compatibility Libraries focus on backporting features from newer framework releases so that devices running previous releases can take advantage of the newer APIs. The major compatibility libraries are v4 and v7-appcompat.
2-Component Libraries the Android Support Library also provides smaller, more modular component libraries that enable developers to add features that are otherwise not part of the standard framework. These self-contained libraries can be easily added or removed from a project without concern for dependencies. There are several valuable component libraries to consider:
Other Libraries The Android Support Library also contains a few other libraries that are used less often, but still worth mentioning:
When should I use the Android Support Library?
You should use one of the support libraries when you need specific framework features that are newer than the minSdkVersion of your app or that are not available in the standard framework.
and I refer this tutorial
This answer is relevant for clients of support libraries which their version is >= 26.0.0:
For more information, see Support Library - Version Support and Package Names.