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