What is the API level to use with Android library support?

I want to create an Android application that can be used on 2.3.3 to 4.0.3 . I want to use the support library to use fragments, etc.

Is the build target set to API level 10 (2.3.3) or set to 15 (4.0.3)?

+7
source share
2 answers

The answers here are somewhat misleading, since you do not need to set targetSdkVersion="15" in order for your application to be used before version 4.0.3. Setting only minSdkVersion="10" will allow you to use your application on all devices running Gingerbread and above.

The targetSdkVersion attribute indicates the level of the API at which the application is intended to run. It is desirable that its value correspond to the last released SDK ( "15" , at the time of this publication). Strictly speaking, however, its value should be indicated by the highest SDK version number with which you tested your application.

The advantages of the higher targetSdkVersion are that it allows you to use the new brilliant features in the recently released APIs. For example, if in this case you did not set your targetSdkVersion , it would default to minSdkVersion your minSdkVersion (which is currently "10" ). Because of this, your application will not be able to use the new user interface themes (i.e. Theme.Holo ) introduced in HoneyComb and ICS , and will probably be forced into compatibility mode (which is ugly and makes your application look old and poorly supported).

+5
source

You must set build 15 for your purpose, but the minimum SDK is 10.

That way, the support libraries will still run at 10, but with reflection, you can also directly access the higher features of the API version if you want to.

+2
source

All Articles