Appcompat, compatibility, and support libraries fo

2019-06-17 10:34发布

问题:

We have an existing Android app that supports API Level 8 up to 18. We used compatibility libraries 19.1.0. Now we are changing/upgrading to:

  1. Minimum SDK = 14
  2. Target = android-22

Now given that there are v4, v7, v13 support, compatibility, and appcompat libraries in different versions, I'm not sure which ones to include and which ones not.

We are using maven for dependency management and using Maven SDK deployer

回答1:

If you are using a minSDK of 14 then technically you do not need any of them. However, here are things to think about:

Support v4 (com.android.support:support-v4:23.0.0)

  • App Components Fragment - Adds support for encapsulation of user interface and functionality with Fragments, enabling applications to provide layouts that adjust between small and large-screen devices.
  • NotificationCompat - Adds support for rich notification features.
  • LocalBroadcastManager - Allows applications to easily register for and receive intents within a single application without broadcasting them globally.
  • User Interface ViewPager - Adds a ViewGroup that manages the layout for the child views, which the user can swipe between.
  • PagerTitleStrip - Adds a non-interactive title strip, that can be added as a child of ViewPager.
  • PagerTabStrip - Adds a navigation widget for switching between paged views, that can also be used with ViewPager.

App Compat v7 (com.android.support:appcompat-v7:23.0.0)

Here are a few of the key classes included in the v7 appcompat library

  • ActionBar - Provides an implementation of the action bar user interface pattern. For more information on using the Action Bar, see the Action Bar developer guide.
  • ActionBarActivity - Adds an application activity class that must be used as a base class for activities that uses the Support Library action bar implementation.
  • ShareActionProvider - Adds support for a standardized sharing action (such as email or posting to social applications) that can be in an action bar.

Support v13 (com.android.support:support-v13:23.0.0)

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. For more information about fragments, see the Fragments developer guide. For detailed information about the v13 Support Library APIs, see the android.support.v13 package in the API reference.

See their revisions here: http://developer.android.com/tools/support-library/index.html

See all of the libraries listed here: http://developer.android.com/tools/support-library/features.html



回答2:

Android Support Library v4, v7, v8, v13 and v17 are totally different libraries. v7 is not the newer version of v4 and v8 is not the newer version of v7. You can't find a component provided by v7 in v4 and with the same reason, you can't find a component provided by v8 in v7.

The number of each v indicate the minimum Android version that library provided inside can be backward compatible. For example, if you use a v8 component. You application will be able to run on a phone with API Level 8 and above. If you need to use a component from both v7 and v8, you have to include BOTH of them to your project.

Since your minSdkVersion is now 14, you are safe to use any of v4, v7, v8 and v13.

Please note that the latest version of Android Support Library is now 22.0.0. I suggest you to move from 19.1.0 to 22.0.0. It is far better.