Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Support Package / Compatibility Library - use v4 or v13?

I've just read this description of the Android Support Package / Compatibility Library...

http://developer.android.com/sdk/compatibility-library.html

... and it's left me a little confused! It says that the v13 library is a superset of v4 but I thought it was the other way around?

Getting practical: If I want to use the compatibility library such that my app builds and works fine for phones running Android 2.2 (API 8) through to 4.0 (API 14) and beyond, will v4 suffice for me?

like image 317
Adil Hussain Avatar asked Mar 29 '12 13:03

Adil Hussain


People also ask

Should I use Android support libraries?

Originally a single binary library for apps, the Android Support Library has evolved into a suite of libraries for app development. Many of these libraries are now a strongly recommended, if not essential, part of app development.

What is v4 and v7 in Android?

difference. v4 has largest set of API's than others like App component, User Interface Feature, data handling ,network connectivity and utilities. v7 provided specfic feature sets that can be included in your app independently.

Which v7 support libraries are used for modifying UI settings?

v7 Preference Support Library The preference package provides APIs to support adding preference objects, such as CheckBoxPreference and ListPreference , for users to modify UI settings. The v7 Preference library adds support for interfaces, such as Preference. OnPreferenceChangeListener and Preference.


2 Answers

To target API 8 (v2.2) you should use the v4 version.

Large sections of the v13 will work, but if you use any of the features in it that rely on the platform 13 APIs, your app will blow up on older devices.

Unless there's a particularly compelling reason to need v13, I'd suggest going straight for v4.

like image 167
Ollie C Avatar answered Sep 25 '22 03:09

Ollie C


The Answer is correct but is also slightly confusing! Currently there are 3 support jars: V4, V7 and V13. Unfortunately V7 is specifically for gridlayout only and is therefore NOT a superset.

We are interested in only one jar from the support library [unless we also want gridlayout (I don't know what it is!)]. Therefore we are looking at our android:minSdkVersion="8" and checking it against the jars. So we want V4.

V13 is only a superset in the sense that it duplicates the V4 methods, NOT the code. I.e. the use of V13 would be incorrect in this example.

like image 20
loser114491 Avatar answered Sep 22 '22 03:09

loser114491