uses-sdk-element.jd revision d56760ce1ecb949a258e1c667eb46446e2575269
1page.title=<uses-sdk>
2@jd:body
3
4<dl class="xml">
5<dt>syntax:</dt>
6<dd><pre>
7&lt;uses-sdk android:<a href="#min">minSdkVersion</a>="<i>integer</i>" 
8          android:<a href="#max">maxSdkVersion</a>="<i>integer</i>"
9          android:<a href="#target">targetSdkVersion</a>="<i>integer</i>" /&gt;</pre></dd>
10
11<dt>contained in:</dt>
12<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
13
14<dt>description:</dt>
15<dd>Lets you express an application's compatibility with one or more versions of the Android platform,
16by means of an API Level integer. The API Level expressed by an application will be compared to the
17API Level of a given Android system, which may vary among different Android devices.
18</p>
19
20<p>
21Despite its name, this element is used to specify the API Level, <em>not</em> the 
22version number of the SDK (software development kit).  The API Level is always 
23a single integer; the SDK version may be split into major and minor components 
24(such as 1.5).  You cannot derive the API Level from the SDK version number 
25(for example, it is not the same as the major version or the sum of the major 
26and minor versions).</p>
27
28<p>For more information, read about 
29<a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a> and
30<a href="{@docRoot}guide/publishing/versioning.html">Versioning Your Applications</a>.
31</p></dd> 
32
33
34<dt>attributes:</dt>
35
36<dd>
37<dl class="attr">
38  <dt><a name="min"></a>{@code android:minSdkVersion}</dt>
39  <dd>An integer designating the minimum API Level required
40  for the application to run. The Android system will prevent the user from installing
41  the application if the system's API Level is lower than the value specified in
42  this attribute. You should always declare this attribute.
43  
44  <p class="caution"><strong>Caution:</strong>
45  If you do not declare this attribute, then a value of "1" is assumed, which
46  indicates that your application is compatible with all versions of Android. If your
47  application is <em>not</em> compatible with all versions (for instance, it uses APIs
48  introduced in API Level 3) and you have not declared the proper <code>minSdkVersion</code>,
49  then when installed on a system with an API Level less than 3, the application will crash
50  during runtime when attempting to access the unavailable APIs. For this reason, 
51  be certain to declare the appropriate API Level
52  in the <code>minSdkVersion</code> attribute.</p>
53  </dd>
54  
55  <dt><a name="max"></a>{@code android:maxSdkVersion}</dt>
56  <dd>An integer designating the maximum API Level on which the application is 
57  designed to run. The Android system will prevent the user from installing the 
58  application if the system's API Level is higher than the value specified
59  in this attribute. 
60  
61  <p>Introduced in: API Level 4</p>
62  </dd>
63  
64  <dt><a name="target"></a>{@code android:targetSdkVersion}</dt>
65  <dd>An integer designating the API Level that the application is targetting.
66  
67  <p>With this attribute set, the application says that it is able to run on 
68  older versions (down to {@code minSdkVersion}), but was explicitly tested to work 
69  with the version specified here.
70  Specifying this target version allows the platform to disable compatibility
71  settings that are not required for the target version (which may otherwise be turned on
72  in order to maintain forward-compatibility) or enable newer features that are not
73  available to older applications. This does not mean that you can program different 
74  features for different versions of the platform&mdash;it simply informs the platform that you
75  have tested against the target version and the platform should not perform any extra
76  work to maintain forward-compatibility with the target version.</p>
77  
78  <p>Introduced in: API Level 4</p>
79  </dd>
80
81</dl></dd>
82
83<!-- ##api level indication## -->
84<dt>introduced in:</dt>
85<dd>API Level 1</dd>
86
87</dl>
88