Reputation: 2786
I want to create an Android app that can be used on 2.3.3
all the way through to 4.0.3
. I want to use the Support Library, so that I can use fragments, etc.
Do I set the build target to API level 10 (2.3.3) or do I set it to 15 (4.0.3)?
Upvotes: 7
Views: 2398
Reputation: 2779
You should set your build target to 15, but minimum SDK to 10.
This way, the Support Libraries will still work on 10, but with reflection you will also be able to directly access higher API version features if you so wanted.
Upvotes: 2
Reputation: 83303
The answers here are somewhat misleading, as you don't need to set your targetSdkVersion="15"
in order for your application to be used all the way up to version 4.0.3. Setting your minSdkVersion="10"
alone will allow you to use your application on all devices running Gingerbread and above.
The targetSdkVersion
attribute specifies the API level on which the application is designed to run. Preferably you would want its value to correspond to the most recently released SDK ("15"
, at the time of this posting). Strictly speaking, however, its value should be given by the largest SDK version number that you have tested your application against.
The benefits of a higher targetSdkVersion
is that it will enable you to take advantage of shiny new features in the recently released APIs. For instance, if in this case you didn't set your targetSdkVersion
, it would default to your minSdkVersion
(which is currently "10"
). Because of this, your application won't be able to make use of the new UI themes (i.e. Theme.Holo
) introduced in HoneyComb
and ICS
, and will probably be forced into compatibility mode (which is ugly and makes your app look old and poorly maintained).
Upvotes: 5