Mukesh Bhojwani Mukesh Bhojwani - 3 years ago 222
Android Question

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?


Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download