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