148

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?

1

4 Answers 4

169

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.

Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages.


Below is difference from Support Library Packages:

v4 Support Library

This library is designed to be used with Android 1.6 (API level 4) Android 2.3 (API level 9) Android 4.0 (API level 14) and higher. It includes the largest set of APIs compared to the other libraries, including support for application components, user interface features, accessibility, data handling, network connectivity, and programming utilities.

v7 Libraries

There are several libraries designed to be used with Android 2.1 (API level 7) Android 2.3 (API level 9) Android 4.0 (API level 14) and higher. These libraries provide specific feature sets and can be included in your application independently from each other.

v7 appcompat library

This library adds support for the Action Bar user interface design pattern.

Note: This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part of this library's classpath.

So yes you need both jars if you want to use v7.


Update for android-support-v13.jar

v13 Support Library

This interface was deprecated in API level 27.1.0. Use Fragment instead of the framework Fragment.

v13 Support Library

This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support for the Fragment user interface pattern with the (FragmentCompat) class and additional fragment support classes

When you see the package details it has a class FragmentCompat as given in definition. So it has not the all classes of appcompat library.

4
  • 2
    If you are developing an app from min api 19. Do you need these?
    – user5366495
    Commented Feb 2, 2017 at 16:50
  • 2
    v4 Support Libraries – These libraries are designed to be used with Android 2.3 (API level 9) and higher. Commented Jun 5, 2017 at 13:20
  • 1
    And v7 Support Libraries – There are several libraries designed to be used with Android 2.3 (API level 9) and higher. Commented Jun 5, 2017 at 13:21
  • @user5366495 Probably yes. Most of the good things are for API21 and above and if you want to use it on lower you should use the support library for that. So you might still need it for API19.
    – Mahdi-Malv
    Commented Feb 20, 2019 at 7:21
53

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 recyclerView library

  • v7 pallete library etc

v7 appcompat library has following key classes ActionBar, ActionBarActivity, ShareActionProvider.

So adding,

com.android.support:appcompat-v7:21.0.+

dependency in your gradle file, imports the above-mentioned classes.

Bonus

Other support libraries

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

1
  • 7
    This should be the accepted answer, clearly explains everything in simple words.
    – gegobyte
    Commented Sep 30, 2018 at 9:02
44

Support library only required if your minimum sdk version is less than API Level 11. otherwise you do not need to add support library to your project for Api Level 11 or Greater.

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.

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.

Yes you need to add reference of both libraries if you want to use it.

does android-support-v13.jar has appcompat?

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.

6
  • 9
    DrawerLayout / NavigationDrawer currently exists only in support libraries. Commented Mar 13, 2015 at 9:14
  • 3
    There are other components that you may use in your Android app that is based on one of the support libraries which is not included by default in APIs more than 11 such as com.android.support:multidex:1.0.0 and com.android.support:design:23.1.0. check this for full info: developer.android.com/tools/support-library/features.html
    – aselims
    Commented Mar 7, 2016 at 14:10
  • as google says in developer.android.com/topic/libraries/support-library/… there is no diffrence between v4 support and v7 support. both are for api 9 and above. is this true?!
    – Mahdi
    Commented Sep 27, 2016 at 6:52
  • Kenji, yes it's true. Google shift min support from 4 to 9 and from 7 to 9 and both libraries now duplicates each other. Commented Jan 29, 2017 at 12:37
  • If you are developing an app from min api 19. Do you need these?
    – user5366495
    Commented Feb 2, 2017 at 16:50
5

This answer is relevant for clients of support libraries which their version is >= 26.0.0:

Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages.

For example, the support-v4 and the support-v7 package both support a minimum API level of 14, for releases of the Support Library from 26.0.0 and higher.

For more information, see Support Library - Version Support and Package Names.