<uses-sdk>

syntax:
<uses-sdk android:minSdkVersion="integer" 
          android:maxSdkVersion="integer"
          android:targetSdkVersion="integer" />
contained in:
<manifest>
description:
Lets you express an application's compatibility with one or more versions of the Android platform, by means of an API Level integer. The API Level expressed by an application will be compared to the API Level of a given Android system, which may vary among different Android devices.

Despite its name, this element is used to specify the API Level, not the version number of the SDK (software development kit). The API Level is always a single integer; the SDK version may be split into major and minor components (such as 1.5). You cannot derive the API Level from the SDK version number (for example, it is not the same as the major version or the sum of the major and minor versions).

For more information, read about Android API Levels and Versioning Your Applications.

attributes:
android:minSdkVersion
An integer designating the minimum level of the Android API that's required for the application to run.

Prior to installing an application, the Android system checks the value of this attribute and allows the installation only if it is less than or equal to the API Level used by the system itself.

If you do not declare this attribute, then a value of "1" is assumed, which indicates that your application is compatible with all versions of Android. If your application is not universally compatible (for instance if it uses APIs introduced in Android 1.5) and you have not declared the proper minSdkVersion, then when installed on a system with a lower API Level, the application will crash during runtime. For this reason, be certain to declare the appropriate API Level in the minSdkVersion attribute.

android:maxSdkVersion
An integer designating the maximum level of the Android API that the application is compatible with. You can use this to ensure your application is filtered out of later versions of the platform when you know you have incompatibility with them.

Prior to installing an application, the Android system checks the value of this attribute and allows the installation only it is greater than or equal to the API Level used by the system itself.

Introduced in: API Level 4

android:targetSdkVersion
An integer designating the API Level that the application is targetting.

With this attribute set, the application says that it is able to run on older versions (down to minSdkVersion), but was explicitly tested to work with the version specified here. Specifying this target version allows the platform to disable compatibility settings that are not required for the target version (which may otherwise be turned on in order to maintain forward-compatibility) or enable newer features that are not available to older applications. This does not mean that you can program different features for different versions of the platform—it simply informs the platform that you have tested against the target version and the platform should not perform any extra work to maintain forward-compatibility with the target version.

Introduced in: API Level 4

introduced in:
API Level 1
↑ Go to top