1page.title=<uses-library>
2parent.title=The AndroidManifest.xml File
3parent.link=manifest-intro.html
4@jd:body
5
6<div class="sidebox-wrapper"> 
7<div class="sidebox">
8    <img src="{@docRoot}assets/images/icon_play.png" style="float:left;margin:0;padding:0;"> 
9    <p style="color:#669999;padding-top:1em;">Google Play Filtering</p> 
10    <p style="padding-top:1em;">Google Play uses the &lt;uses-library&gt; elements declared
11    in your app manifest to filter your app from devices that do not meet it's library
12    requirements. For more information about filtering, see the topic
13    <a href="{@docRoot}google/play/filters.html">Google Play filters</a>.</p>
14  </div>
15</div>
16
17<dl class="xml">
18
19<dt>syntax:</dt>
20<dd>
21<pre class="stx">
22&lt;uses-library
23  android:<a href="#nm">name</a>="<var>string</var>"
24  android:<a href="#rq">required</a>=["true" | "false"] /&gt;
25</pre>
26</dd>
27<dt>contained in:</dt>
28<dd>
29    <code>
30        <a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a>
31    </code>
32</dd>
33<dt>description:</dt>
34<dd itemprop="descridption">
35    Specifies a shared library that the application must be linked against.
36    This element tells the system to include the library's code in the class
37    loader for the package.
38    <p>
39        All of the {@code android} packages (such as {@link android.app},
40        {@link android.content}, {@link android.view}, and {@link android.widget})
41        are in the default library that all applications are automatically linked
42        against.  However, some packages (such as {@code maps}) are
43        in separate libraries that are not automatically linked.  Consult the
44        documentation for the packages you're using to determine which library
45        contains the package code.
46    </p>
47    <p>
48        This element also affects the installation of the application on a particular device and
49        the availability of the application on Google Play:
50    </p>
51    <dl>
52        <dt><em>Installation</em></dt>
53        <dd>
54            If this element is present and its {@code android:required} attribute is set to
55            {@code true}, the {@link android.content.pm.PackageManager} framework won't let the user
56            install the application unless the library is present on the user's device.
57        </dd>
58    </dl>
59    <p>
60        The {@code android:required} attribute is described in detail in the following section.
61    </p>
62</dd>
63<dt>attributes:</dt>
64<dd>
65    <dl class="attr">
66        <dt><a name="nm"></a>{@code android:name}</dt>
67        <dd>
68            The name of the library. The name is provided by the
69            documentation for the package you are using. An example of this is
70            &quot;<code>android.test.runner</code>&quot;, a package that contains Android test
71            classes.
72        </dd>
73        <dt><a name="rq"></a>{@code android:required}</dt>
74        <dd>
75            Boolean value that indicates whether the application requires the
76            library specified by {@code android:name}:
77            <ul>
78                <li>
79                    <code>&quot;true&quot;</code>: The application does not function without this
80                    library. The system will not allow the application on a device that does not
81                    have the library.
82                </li>
83                <li>
84                    <code>&quot;false&quot;</code>: The application can use the
85                    library if present, but is designed to function without it if necessary.
86                    The system will allow the application to be installed, even if the library is
87                    not present. If you use <code>&quot;false&quot;</code>, you are responsible for
88                    checking at runtime that the library is available.
89                    <p>
90                        To check for a library, you can use reflection to determine
91                        if a particular class is available.
92                    </p>
93                </li>
94            </ul>
95            <p>
96                The default is <code>&quot;true&quot;</code>.
97            </p>
98            <p>Introduced in: API Level 7.</p>
99        </dd>
100    </dl>
101</dd>
102<!-- ##api level indication## -->
103<dt>introduced in:</dt>
104<dd>API Level 1</dd>
105
106<dt>see also:</dt>
107<dd>
108  <ul>
109    <li>{@link android.content.pm.PackageManager}</li>
110  </ul>
111</dd>
112</dl>