Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android support lib v4 or v13

I have developed an Android application build using API 13 and min-sdk also API 13. I want to incorporate the swiping across the tabs, and for the purpose I am using v4 support library.

I have following questions,

  1. Which support library I should use v4 or v13?
  2. Should I change the target to API 14? More importantly how do I decide, which should be my targeted API to compile against?
like image 432
Mukesh Bhojwani Avatar asked Mar 13 '13 06:03

Mukesh Bhojwani


People also ask

What is v4 and v7 in Android?

v4 Support Libraries – These libraries are designed to be used with Android 2.3 (API level 9) and higher. – Vadik. 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.


2 Answers

For question 1: as @StinePike said, depending on what you use as minimum, you should use v4 for min-sdk = 4-12 if your min sdk is >=13 its ok to use v13.
Update As stated by Frank in the comments, with revision 26.0.0 and above the minsdk for all support libraries is API level 14. See https://developer.android.com/topic/libraries/support-library/index.html#api-versions for more details.

For question 2: the best target depends on what you plan to do, if you want to provide some features that were introduced in a higher sdk level, you have to use higher target-sdk but make sure that you check the android version to not use android apis that are introduced in a higer sdk version on a device with an older android version

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    // safe to use api 11 / Android 3.0 stuf
} else {
    // only use api level <= 10 stuff
}

for min-sdk its the same. if you require stuff of api level >= 10 you have to use min-sdk 10

My opinion: don't use api level < 10, its not worth it... with 10 you reach 90% of the android devices
My opinion (as of April 2016): don't use api level < 16, its not worth it... with 16 you reach ~95% of the android devices

For checking the distribution of android OS version check: https://developer.android.com/about/dashboards/index.html

like image 147
Dodge Avatar answered Sep 29 '22 06:09

Dodge


from the developer site you can find

Note: The Support Package includes more than one support library. Each one has a different minimum API level. For example, one library requires API level 4 or higher, while another requires API level 13 or higher (v13 is a superset of v4 and includes additional support classes to work with v13 APIs). The minimum version is indicated by the directory name, such as v4/ and v13/.

I think that clearly answer your question. If you want to support lower os version ( 4 or higher) and the v4 library apis fullfill your target then use it else use v13

like image 26
stinepike Avatar answered Sep 29 '22 07:09

stinepike