uses-sdk-element.jd revision 71d4b289a7a934ecd16c3036b812d40db6d3a74d
1page.title=<uses-sdk>
2@jd:body
3
4<dl class="xml">
5<dt>syntax:</dt>
6<dd><pre class="stx">&lt;uses-sdk android:<a href="#min">minSdkVersion</a>="<i>integer</i>" /&gt;</pre></dd>
7
8<dt>contained in:</dt>
9<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
10
11<dt>description:</dt>
12<dd>Lets you express an application's compatibility with one or more versions of the Android platform,
13by means of an API Level integer. The API Level expressed by an application will be compared to the
14API Level of a given Android system, which may vary among different Android devices.
15</p>
16
17<p>
18Despite its name, this element is used to specify the API Level, <em>not</em> the 
19version number of the SDK (software development kit).  The API Level is always 
20a single integer; the SDK version may be split into major and minor components 
21(such as 1.5).  You cannot derive the API Level from the SDK version number 
22(for example, it is not the same as the major version or the sum of the major 
23and minor versions).</p>
24
25<p>For more information, read about 
26<a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a> and
27<a href="{@docRoot}guide/publishing/versioning.html">Versioning Your Applications</a>.
28</p></dd> 
29
30
31<dt>attributes:</dt>
32
33<dd>
34<dl class="attr">
35  <dt><a name="min"></a>{@code android:minSdkVersion}</dt>
36  <dd>An integer designating the minimum level of the Android API that's required 
37  for the application to run.
38  
39  <p>Prior to installing an application, the Android system checks the value of this
40  attribute and allows the installation only if it
41  is less than or equal to the API Level used by the system itself.</p>
42  
43  <p>If you do not declare this attribute, then a value of "1" is assumed, which
44  indicates that your application is compatible with all versions of Android. If your
45  application is <em>not</em> universally compatible (for instance if it uses APIs
46  introduced in Android 1.5) and you have not declared the proper <code>minSdkVersion</code>, 
47  then when installed on a system with a lower API Level, the application 
48  will crash during runtime. For this reason, be certain to declare the appropriate API Level
49  in the <code>minSdkVersion</code> attribute.</p>
50  </dd>
51  
52  <dt><a name="max"></a>{@code android:maxSdkVersion}</dt>
53  <dd>An integer designating the maximum level of the Android API that the application is 
54  compatible with. You can use this to ensure your application is filtered out
55  of later versions of the platform when you know you have incompatibility with them.</p>
56  
57  <p>Prior to installing an application, the Android system checks the value of this
58  attribute and allows the installation only it
59  is greater than or equal to the API Level used by the system itself.</p>
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 is is be 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 version allows the platform to disable compatibility
71  code that is not required or enable newer features that are not
72  available to older applications.</p>
73  
74  <p>Introduced in: API Level 4</p>
75  </dd>
76
77</dl></dd>
78
79<!-- ##api level indication## -->
80<dt>introduced in:</dt>
81<dd>API Level 1</dd>
82
83</dl>
84